InstallShield 2016 ยป InstallScript Language Reference
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 ParsePath function.
*
* The ParsePath is called six times to retrieve various
* information from a fully-qualified file name.
*
\*--------------------------------------------------------------*/
#define EXAMPLE_PATH "C:\\Windows\\Readme.txt"
#define TITLE_TEXT "ParsePath example"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_ParsePath(HWND);
function ExFn_ParsePath(hMSI)
STRING szMsg, svReturnString;
begin
// Get the disk letter from the path.
if (ParsePath (svReturnString, EXAMPLE_PATH, DISK) < 0) then
MessageBox ("ParsePath failed", SEVERE);
else
szMsg = "nOperation = DISK\n\nParsed Path: %s";
SprintfBox (INFORMATION, TITLE_TEXT , szMsg, svReturnString);
endif;
// Get the full path.
szMsg = "nOperation = PATH\n\nParsed Path: %s";
if (ParsePath (svReturnString, EXAMPLE_PATH, PATH) < 0) then
MessageBox ("ParsePath failed", SEVERE);
else
SprintfBox (INFORMATION, TITLE_TEXT, szMsg, svReturnString);
endif;
// Get the directory name.
if (ParsePath (svReturnString, EXAMPLE_PATH, DIRECTORY) < 0) then
MessageBox ("ParsePath failed", SEVERE);
else
szMsg = "nOperation = DIRECTORY\n\nParsed Path: %s";
SprintfBox (INFORMATION, TITLE_TEXT, szMsg, svReturnString);
endif;
// Get the file name and extension.
if (ParsePath (svReturnString, EXAMPLE_PATH, FILENAME) < 0) then
MessageBox ("ParsePath failed", SEVERE);
else
szMsg = "nOperation = FILENAME\n\nParsed Path: %s";
SprintfBox (INFORMATION, TITLE_TEXT, szMsg, svReturnString);
endif;
// Get file name without extension.
if (ParsePath (svReturnString, EXAMPLE_PATH, FILENAME_ONLY) < 0) then
MessageBox ("ParsePath failed", SEVERE);
else
szMsg = "nOperation = FILE_NAME_ONLY\n\nParsed Path: %s";
SprintfBox (INFORMATION, TITLE_TEXT, szMsg, svReturnString);
endif;
// Get the file extension.
if (ParsePath (svReturnString, EXAMPLE_PATH, EXTENSION_ONLY) < 0) then
MessageBox ("ParsePath failed", SEVERE);
else
szMsg = "nOperation = EXTENSION_ONLY\n\nParsed Path: %s";
SprintfBox (INFORMATION, TITLE_TEXT, szMsg, svReturnString);
endif;
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |