InstallShield 2018 » 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 GetShortcutInfo function.
*
* GetShortcutInfo is called to find the attributes of a target
* file or subfolder.
*
* Note: Before running this script, set the defined constants
* FOLDER_NAME and SHORTCUT so that they reference an
* existing folder name and shortcut.
*
\*--------------------------------------------------------------*/
// Define constants to reference the shortcut or folder name.
#define FOLDER_NAME "C:\\Windows\\Start Menu\\Programs"
#define SHORTCUT "InstallShield"
function OnFirstUIAfter()
STRING svCmdLine, svWrkDir, svIconPath;
STRING svShortCutKey, svGroupPath, szTitle, szMsg, szInfo, svMinFlag;
STRING svMinimizeFlag;
NUMBER nvIconIndex, nvMinimizeFlag, nResult, nvMinFlag;
LIST listInfo, listID;
begin
// Search for an item in the FOLDER_NAME folder.
nResult = GetShortcutInfo (FOLDER_NAME, SHORTCUT, svCmdLine, svWrkDir,
svIconPath, nvIconIndex, svShortCutKey,
nvMinimizeFlag);
// Create string list.
listInfo = ListCreate (STRINGLIST);
// Error check GetShortcutInfo.
if (nResult < 0) then
// Report the error; then abort.
MessageBox ("GetShortcutInfo failed.", SEVERE);
abort;
// Check if the item is an application.
elseif (nResult = IS_ITEM) then
// Add the command line to the string list.
Sprintf (szInfo, "The command line of %s: %s", SHORTCUT, svCmdLine);
ListAddString (listInfo, szInfo, AFTER);
// Add the working directory to string list.
Sprintf (szInfo, "The working directory of %s: %s", SHORTCUT, svWrkDir);
ListAddString (listInfo, szInfo, AFTER);
// Add the icon path to string list.
Sprintf (szInfo, "The icon path of %s: %s", SHORTCUT, svIconPath);
ListAddString (listInfo, szInfo, AFTER);
// Add icon index to string list.
Sprintf (szInfo, "The index of the icon: %d", nvIconIndex);
ListAddString (listInfo, szInfo, AFTER);
// Add shortcut key to string list.
Sprintf (szInfo, "The shortcut key of %s: %s", SHORTCUT,
svShortCutKey);
ListAddString (listInfo, szInfo, AFTER);
// Check if the item is a folder.
elseif (nResult = IS_FOLDER) then
// Add a message to string list.
Sprintf (szInfo, "The item is a subfolder. GetShortcutInfo does not " +
"retrieve very much information about subfolders.");
ListAddString (listInfo, szInfo, AFTER);
endif;
// Display the string list.
szTitle = "GetShortcutInfo Example";
szMsg = "The following are attributes of the item:";
SdShowInfoList (szTitle, szMsg, listInfo);
// Destroy the list.
ListDestroy (listID);
end;
InstallShield 2018 Help LibrarySeptember 2018 |
Copyright Information | Flexera |