InstallShield 2016 » 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 EzBatchReplace function.
*
* EzBatchReplace is called to replace lines in a batch file.
*
* This script replaces three lines in the specified batch file.
* First, it replaces the SET COMSPEC command. Then it replaces
* the PATH statement. Finally, it replaces the command line
* that references SMARTDRV.EXE.
*
* Note: Before running this script, create a batch file
* named ISExampl.bat and store it in the root of
* drive C. For best effect, that file should include
* the following lines:
*
* SET COMSPEC=C:\COMMAND.COM
* PATH C:\
* SMARTDRV.EXE
*
\*--------------------------------------------------------------*/
#define EXAMPLE_BAT "C:\\ISExampl.bat"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_EzBatchReplace(HWND);
function ExFn_EzBatchReplace(hMSI)
begin
// Set the default batch file.
BatchSetFileName (EXAMPLE_BAT);
// Replace the SET COMSPEC statement.
if (EzBatchReplace ("SET COMSPEC=C:\\DOS\\COMMAND.COM") < 0) then
MessageBox ("First call to EzBatchReplace failed.", SEVERE);
else
MessageBox ("First call to EzBatchReplace succeeded.", INFORMATION);
endif;
// Replace the PATH command.
if (EzBatchReplace ("PATH C:\\DOS;C:\\MYAPP") < 0) then
MessageBox ("Second call to EzBatchReplace failed.", SEVERE);
else
MessageBox ("Second call to EzBatchReplace succeeded.", INFORMATION);
endif;
// Replace the SMARTDRIVE statement.
if (EzBatchReplace ("SMARTDRV.EXE /P 1024 /C 512") < 0) then
MessageBox ("Third call to EzBatchReplace failed.", SEVERE);
else
MessageBox ("Third call to EzBatchReplace succeeded.", INFORMATION);
endif;
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |