syntaxwindows-installerinstallshieldinstallscript

Installscript Syntax: Calling a Property, converting to variable, then setting property


So I have this pseudo code I need Installscript syntax for, for a Basic MSI installation I am creating with Installshield.

I need to call in a property previously set, [SERIAL] which is three digits long.

If the value is higher than 235 I need to subtract 235 from the value and save it as a string, and another string seperate as 2, otherwise 1. The two result strings then need to be set as new global properties for use later in the installation.

Pseudo code:

// call in the SERIAL property here.

if SERIAL > 235 then

string sIOVERSION = 2;
string sIOIP = "192.22." + (SERIAL - 235) + ".1";

else

string sIOVERSION = 1;
string sIOIP = "192.2." + SERIAL + ".1";

endif

// update properties [IOVER] and [IOIP] to the values of sIOVERSION and sIOIP

Solution

  • There are other approaches, but as a starting point for doing this in an InstallScript custom action, look for MsiGetProperty and MsiSetProperty, StrToNum, and Sprintf.