User Guide

497
Calling WiseScripts with Custom Actions
Example: You have an .MSI named Core and a WiseScript named CorePlus. CorePlus
includes an Install File(s) script action that installs a file named A.dll. You want to make
sure that A.dll gets uninstalled when Core is uninstalled.
In the Core .MSI, do the following:
1. Select MSI Script and click the Execute Immediate tab.
2. Scroll down and click directly below the RemoveExistingProducts action.
3. Add an If Statement with a value of NOT Installed.
This condition causes it to run only during initial installation of Core.
4. Add a Run WiseScript From Installation custom action and set:
Custom Action Name to ActionInstallCorePlus
WiseScript .EXE File to C:\Plus\CorePlus.EXE
Leave Command Line blank. On the Properties tab, leave the defaults.
5. Add an End Statement.
The above script lines install CorePlus, which in this example is A.dll. In the
following script lines, you make provisions for the uninstall.
6. Add an If Statement with a value of REMOVE~=“ALL.
This condition causes it to only run during uninstall of Core.
7. Add an Execute Program From Destination custom action and set:
Custom Action Name to RemoveCorePlus
Working Directory to INSTALLDIR
EXE and Command Line to [INSTALLDIR]Unwise32.exe /S install.log
On the Properties tab, leave the defaults.
8. Add an End Statement.
The MSI script looks like this (the script lines are numbered for clarity):
1. If NOT Installed then
2. Run WiseScript From Installation C:\Plus\CorePlus.EXE
3. End
4. If REMOVE~=”ALL” then
5. Execute Program From Destination [INSTALLDIR]unwise32.exe /S install.log Default
Directory Program Files\Core
6. End
In the CorePlus WiseScript, do the following:
1. Add a Get Windows Installer Property script action and set:
Dest. Variable to MAINDIR
Property Name to INSTALLDIR
INSTALLDIR is the installation directory of Core, the main Windows Installer
installation. This sets the WiseScript installation directory to the same value as the
main installation’s installation directory.
2. Add a Set Variable script action and set:
Variable to MAINDIR
New Value to %MAINDIR%
Operation to Remove trailing backslashes.
INSTALLDIR has a trailing backslash, but to be compatible with WiseScript,
MAINDIR cannot have a trailing backslash.