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 CreateDir function.
*
* The user is asked to input a valid directory. If the
* specified directory does not exist, CreateDir is called to
* create it. Then CreateDir is called again to create a
* multilevel directory structure beneath the specified
* directory.
*
\*-----------------------------------------------------------*/
#define DEFAULT_DIR "C:\\ISExampl"
#define SUBDIRS "N_Dir\\A_Dir"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_CreateDir(HWND);
function ExFn_CreateDir(hMSI)
STRING svPath;
begin
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
// Prompt user for a directory to be created.
AskPath ("Please enter a valid path.", DEFAULT_DIR, svPath);
// Check to see if that directory already exists.
if (ExistsDir (svPath) != EXISTS) then
// The directory does not exist; create it.
if (CreateDir (svPath) < 0) then
// Report the error; then abort.
MessageBox ("Unable to create directory", SEVERE);
abort;
else
// Report success
SprintfBox (INFORMATION, "CreateDir", "%s created.", svPath);
endif;
endif;
// Create an entire multilevel directory structure
// beneath the selected directory.
if (CreateDir (svPath ^ SUBDIRS) < 0) then
MessageBox ("Failed to create subdirectories beneath" + svPath +".",
WARNING);
else
SprintfBox (INFORMATION, "CreateDir", "%s created beneath %s.", SUBDIRS,
svPath);
endif;
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |