You want to author a script, but are unsure how to incorporate it into Windows Installer Editor. WiseScript Package Editor, a tool in Wise Installation Studio is the answer. WiseScript Package Editor lets you create custom actions, write scripts to add to your installation project, parse strings, get system information, and much more. This powerful tool adds new authoring possibilities to your installation project. Read on to find out how to create a script then merge it into a project file.
Start WiseScript Package Editor
There are two ways to start WiseScript Package Editor. One method launches WiseScript Package Editor from the Start menu while the other launches it using a script action.
To start WiseScript Package Editor using a script action:
1. In Wise Installer Editor (or Wise for Windows Installer), click the MSI Script tab.
2. In the Actions pane, double-click the Run WiseScript from Installation action.
3. In the Run WiseScript from Installation dialog box, click the Options button then select Create New WiseScript. The Save As dialog box appears.
4. Navigate to where you want to save your script, name the script, then save it. Once the file is saved, WiseScript Package Editor (or WiseScript Express depending on the version of Wise you have installed) opens.
To create a Script in WiseScript Package Editor
For this example, you will create a script that enables you to pass a Windows Installer property to a variable.
1. In WiseScript Package Editor, double-click the Set Variable script action in the Actions pane. The Set Variable dialog box appears.
2. Enter MYVAR in the Variable field, then click OK.
3. Click on the script line following the Set Variable, then double-click the Get Windows Installer Property script action in the Actions pane. The Get Windows Installer Property dialog box appears.
4. Fill in the fields as follows:
Dest. Variable. Enter MYVAR
Property Name. Enter ComputerName
5. Click OK.
6. Select the next script line, then double-click the Display Message script action in the Actions pane. The Display Message Settings dialog box appears.
7. Fill in the fields as follows:
Message Title. Enter INFORMATION
Message Text. Enter This script references the %MYVAR% variable.
8. Click OK.
9. Click the Compile button.
10. Exit WiseScript Package Editor
To merge the Script into Your Project File:
After creating the script, you need to determine the location where the script should be added to the project file.
To call a script action in your project file:
1. Open the Windows Installer Editor and select MSI Script section of the product.
3. Select the Execute Immediate tab.
4. Scroll down in the Installation Sequence to the InstallInitialize action.
5. Place your cursor between the InstallInitialize and InstallFinalize script actions for the custom action to be launched between these two actions during the installation.
6. Double-click the Run WiseScript from Installation script action from the Actions pane. The Run WiseScript from Installation dialog box appears.
7. Enter a name for this action that will be meaningful to you in the Custom Action Name field.
8. Click the Options button, then select Browse for WiseScript.
9. Browse to the .WSE file you created, select it, then click Open.
10. Click OK in the Run WiseScript from Installation dialog box.
The script is added to your installation. If you followed all of the steps in this article, when you run this installation, the INFORMATION dialog box you created appears near the end of the installation (between the InstallInitialize and InstallFinalize script actions), and displays the computer name variable you defined. Your results should be similar to the following graphic.
In order for this script action to only run during install, insert an If Statement around the custom action that includes the following condition:
An End Statement should follow the Run WiseScript action.
Adding a script into your installation is as easy as writing the script in WiseScript Package Editor, then inserting it between two actions in Wise Installer Editor. WiseScript Package Express gives you the option to integrate any script into your installation. Use this tool to enhance the functionality of your next installation project.