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 VarSave and VarRestore functions.
*
* This script starts by displaying the starting values of the
* system variables SRCDIR and INSTALLDIR. It then calls VarSave
* to save those values. Next, it assigns new values to SRCDIR
* and INSTALLDIR, and it displays those values. Finally, it
* calls VarRestore to restore the original values, which are
* then displayed.
*
\*--------------------------------------------------------------*/
#define NEW_SOURCE_DIR "C:\\Source"
#define NEW_INSTALL_DIR "C:\\Target"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_VarSave(HWND);
function ExFn_VarSave(hMSI)
begin
// Display the values of SRCDIR and INSTALLDIR.
SprintfBox (INFORMATION, "Starting Source and Target Folders",
"Source:\n\n%s\n\n Target:\n\n%s ",
SRCDIR, INSTALLDIR);
// Save the current values of SRCDIR and INSTALLDIR.
VarSave (SRCTARGETDIR);
// Assign new values to SRCDIR and INSTALLDIR.
SRCDIR = NEW_SOURCE_DIR;
INSTALLDIR = NEW_INSTALL_DIR;
// Display the values of SRCDIR and INSTALLDIR.
SprintfBox (INFORMATION, "New Source and Target Folders",
"New Source:\n\n%s\n\n New Target:\n\n%s",
SRCDIR, INSTALLDIR);
// Restore the old values.
VarRestore (SRCTARGETDIR);
// Display the values of SRCDIR and INSTALLDIR.
SprintfBox (INFORMATION, "Restored Source and Target Folders",
"Source:\n\n%s\n\n Target:\n\n%s ",
SRCDIR, INSTALLDIR);
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |