InstallShield 2015 » InstallScript Language Reference Note: To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release. /*-------*\ * * InstallShield Example Script * * Demonstrates the ConfigFileLoad and ConfigFileSave functions. * * This example script shows how to open a configuration file * for editing, how to create a backup of the original file, * and how to save and close the edited file. * * To demonstrate how the file backup feature of ConfigFileSave * prevents the overwriting of existing files, this script loads * and saves two different configuration files. The first file * is backed up with a specific file name. The second is backed * up with a wildcard extension so that ConfigFileSave will * generate a unique file extension consisting of three digits. * * Note: Before running this script, create two files * (ISExamp1.sys and ISExamp2.sys) in the root of * drive C. For best effect, you should delete or * move any other files named ISExamp1.* or ISExamp2.*. * \*-------*/ // Names of Config files and backup files used in this example. define EXAMPLE1 "ISEXAMP1"
define EXAMPLE2 "ISEXAMP2"// Full names of Config files. define EXAMPLE1_SYS "C:\\" + EXAMPLE1 + ".sys"
define EXAMPLE2_SYS "C:\\" + EXAMPLE2 + ".sys"// Include Ifx.h for built-in InstallScript function prototypes. include "Ifx.h"export prototype ExFn_ConfigFileLoad(HWND); function ExFn_ConfigFileLoad(hMSI) begin // Load EXAMPLE1_SYS. if (ConfigFileLoad (EXAMPLE1_SYS) < 0) then MessageBox ("Unable to load " + EXAMPLE1_SYS + ".", SEVERE); abort; endif; // Use other Config functions here to edit the first file. // Back up the original file with the extension 'bak'; save the // edited file under its original name. If ISExamp1.bak already // exists, ConfigFileSave will generate a numbered extension. if (ConfigFileSave (EXAMPLE1 + ".bak") < 0) then MessageBox ("Unable to save " + EXAMPLE1_SYS + ".", SEVERE); abort; else MessageBox (EXAMPLE1_SYS + " saved.",INFORMATION); endif; // Load EXAMPLE2_SYS. if (ConfigFileLoad (EXAMPLE2_SYS) < 0) then MessageBox ("Unable to load " + EXAMPLE2_SYS + ".", SEVERE); abort; endif; // Use other Config file functions here to edit the second file. // Back up the original Config file with a numbered extension // and save the edited file under its original name. if (ConfigFileSave (EXAMPLE2 + ".*") < 0) then MessageBox ("Unable to save " + EXAMPLE2_SYS + ".", SEVERE); abort; else MessageBox (EXAMPLE2_SYS + " saved.",INFORMATION); endif; end; Loading Application...
| Documentation Portal |