User Guide

496
Calling WiseScripts with Custom Actions
begin with S. The serial number the end user enters during installation determines the
license file that gets installed, which determines which features are turned on. You set
up the installation to have the license files installed by the WiseScript instead of the .MSI
so that the license files are embedded in the WiseScript .EXE and cannot be opened.
Do the following:
1. Write a WiseScript that uses:
Get Windows Installer Property script action to get the property named
SERIALNUM into a temporary variable named SERIALNUMBER.
Set Variable script action, with the Evaluate Expression operation, to place the
first character of the serial number in a variable named EDITION.
If Statements and Install File(s) script actions to install the appropriate license
file based on the value of the EDITION variable.
2. In MSI Script, add a custom action to Run a WiseScript from Installation and specify
the WiseScript you wrote.
3. During the Windows Installer installation, the WiseScript runs, gets the first
character of the serial number, and installs the appropriate license file.
The sample WiseScript looks like this (the script lines are numbered for clarity):
1. Get Windows Installer Property SERIALNUM into SERIALNUMBER
2. Get Windows Installer Property INSTALLDIR into MAINDIR
3. Set Variable EDITION to LEFT$(SERIALNUMBER,1)
4. Check free disk space
5. If EDITION Equals "R" then
6. Install File c:\Development\Source\RLicense.exe to %MAINDIR%\RLicense.exe
7. Else
8. If EDITION Equals "S" then
9. Install File c:\Development\Source\SLicense.exe to %MAINDIR%\SLicense.exe
10. Else
11. If EDITION Equals "" then
12. Display Message "Invalid serial number"
13. End
14. End
15.End
To ensure the license file is uninstalled when the application is uninstalled, see
Uninstalling Changes Made by a WiseScript.
Uninstalling Changes Made by a WiseScript
You can use the Run WiseScript custom actions to make changes to the destination
computer when the script is run from your .MSI. (Example: You can use the Install
File(s) script action to add files or you can use the Edit Registry script action to add, edit,
or delete keys or values in the registry.) However, the Windows Installer installation
does not recognize any changes the WiseScript makes to the system and therefore will
not uninstall any of these changes during uninstall of the main Windows Installer
installation.
To solve this problem, do the following:
! In the WiseScript, include steps to install an installation log and Unwise32.exe.
! In the .MSI, during an uninstall, use a custom action to call the Unwise32.exe that is
in the WiseScript.