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 ReplaceProfString function.
*
* ReplaceProfString is called for the first time to replace
* the szKeyName key value szOrigValue with the value
* szReplaceValue. Then ReplaceProfString is called again to
* replace the newly set value of szKeyName, szReplaceValue,
* with szOrigValue.
*
* NOTE: In order for this script to run properly, you must set
* the constant EXAMPLE_INI to reference an existing
* initialization file on the target system. That file
* should include the following lines:
*
* [Old Section]
* Old Key=Old value
*
\*--------------------------------------------------------------*/
#define EXAMPLE_INI "C:\\ISExampl.ini"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_ReplaceProfString(HWND);
function ExFn_ReplaceProfString(hMSI)
STRING szSectionName, szKeyName, szOrigValue, szReplaceValue;
begin
szSectionName = "Old Section";
szKeyName = "Old Key";
szOrigValue = "Old value";
szReplaceValue = "New value";
// Replace szOrigValue with szReplaceValue.
if (ReplaceProfString (EXAMPLE_INI, szSectionName, szKeyName, szOrigValue,
szReplaceValue) < 0) then
MessageBox("ReplaceProfString failed.", SEVERE);
abort;
else
SprintfBox (INFORMATION, "Replacement Successful",
"Original: %s\nNew: %s", szOrigValue, szReplaceValue);
endif;
// Replace szReplaceValue with szOrigValue.
if (ReplaceProfString(EXAMPLE_INI, szSectionName, szKeyName, szReplaceValue,
szOrigValue) < 0) then;
MessageBox("ReplaceProfString failed.", SEVERE);
else
SprintfBox (INFORMATION, "Replacement Successful",
"Original: %s\nNew: %s", szReplaceValue, szOrigValue);
endif;
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |