InstallShield 2019 » 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 ConfigMove function.
*
* This example script moves lines in a configuration file.
* First, it calls ConfigFileLoad to load the file. Next, it
* moves the FILES statement to the end of the file. Then,
* it moves the BUFFERS statement to the end of the file.
* Next, it moves the statement referencing Himem.sys before
* the DOS statement. Finally, it backs up the original file
* and saves the edited file.
*
* Note: Before running this script, create a configuration
* file called ISExampl.sys in the root of drive C.
* That file should include the following lines:
*
* FILES=50
* DOS=HIGH,UMB
* DEVICE=C:\WINDOWS\SETVER.EXE
* BUFFERS=50
* Device=C:\Windows\Himem.sys
*
\*-----------------------------------------------------------*/
#define TARGET_CONFIG "C:\\ISExampl.sys"
#define BACKUP_CONFIG "ISExampl.bak"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_ConfigMove(HWND);
function ExFn_ConfigMove(hMSI)
begin
// Load the configuration file to be edited.
if ConfigFileLoad (TARGET_CONFIG) < 0 then
MessageBox ("Unable to load " + TARGET_CONFIG + ".", SEVERE);
abort;
endif;
// Move the FILES statement to the end of the file.
if (ConfigMove ("FILES", "", AFTER) < 0) then
MessageBox ("Unable to move FILES statement.", SEVERE);
else
MessageBox ("FILES statement moved to the end of the file.",
INFORMATION);
endif;
// Move the BUFFERS statement to the end of the file.
if (ConfigMove ("BUFFERS", "", AFTER) < 0) then
MessageBox ("Unable to move BUFFERS statement.", SEVERE);
else
MessageBox ("BUFFERS statement moved to the end of the file.",
INFORMATION);
endif;
// Move the Himem.sys statement before the DOS statement.
if (ConfigMove ("Himem.sys", "DOS", BEFORE) < 0) then
MessageBox ("Unable to move Himem.sys statement.", SEVERE);
else
MessageBox ("Himem.sys statement moved before DOS statement.",
INFORMATION);
endif;
// Save the updated file; back up the original file.
if ConfigFileSave (BACKUP_CONFIG) < 0 then
MessageBox ("Unable to save " + BACKUP_CONFIG+".", SEVERE);
else
MessageBox ("Config file saved. Backup created.",INFORMATION);
endif;
end;
InstallShield 2019 Help LibraryApril 2019 |
Copyright Information | Flexera |