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 CreateShortcut function.
*
* This example places a shortcut to an executable file on the
* Start menu and the Start Programs menu.
*
* Note: Before running this script, set the preprocessor
* constants so that they reference the fully qualified
* names of the Windows Notepad executable file and
* a valid text file on the target system.
*
\*-----------------------------------------------------------*/
#define PROGRAM "C:\\Windows\\Notepad.exe"
#define PARAM "C:\\Windows\\Readme.txt"
function OnFirstUIAfter()
STRING szShortcutFolder, szName, szCommandLine, szWorkingDir;
STRING szShortCutKey, szProgram, szParam, szIconPath;
NUMBER nIcon;
begin
// Set up parameters for call to CreateShortcut.
szShortcutFolder = FOLDER_STARTMENU;
szName = "Notepad Example 1";
szProgram = PROGRAM;
szParam = PARAM;
LongPathToQuote (szProgram, TRUE);
LongPathToShortPath (szParam);
szCommandLine = szProgram + " " + szParam;
szWorkingDir = "";
szIconPath = "";
nIcon = 0;
szShortCutKey = "";
// Add a shortcut to the Start menu.
if (CreateShortcut (szShortcutFolder, szName, szCommandLine, szWorkingDir, szIconPath,
nIcon, szShortCutKey, CS_OPTION_FLAG_REPLACE_EXISTING) < 0) then
MessageBox ("CreateShortcut failed.", SEVERE);
else
SprintfBox (INFORMATION, "CreateShortcut", "%s created successfully.",
szName);
endif;
szShortcutFolder = "";
szName = "Another Notepad Example";
// Add a shortcut to the Programs menu.
if (CreateShortcut (szShortcutFolder, szName, szCommandLine, szWorkingDir, szIconPath,
nIcon, szShortCutKey, CS_OPTION_FLAG_REPLACE_EXISTING) < 0) then
MessageBox ("CreateShortcut failed.", SEVERE);
else
SprintfBox (INFORMATION, "CreateShortcut", "%s created successfully.",
szName);
endif;
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |