### LaunchAppAndWait Example in InstallScript Source: https://docs.revenera.com/installshield/LangRef/LangrefLaunchAppAndWait_example This InstallScript code demonstrates the LaunchAppAndWait function. It presents the user with options to launch Notepad and either wait for it to close or continue the setup immediately, or to exit the installation. It uses predefined macros for program paths and dialog text. The function LaunchAppAndWait is used with WAIT or NOWAIT constants to control execution flow. ```InstallScript #define PROGRAM WINDIR^"NotePAD.EXE" #define LAUNCH_WAIT_TEXT "Launch Notepad; after it closes, continue setup" #define LAUNCH_GO_TEXT "Launch Notepad and continue setup immediately" #define EXIT_TEXT "Exit installation" #include "Ifx.h" export prototype ExFn_LaunchAppAndWait(HWND); function ExFn_LaunchAppAndWait(hMSI) STRING szProgram, szCmdLine, szMsg; BOOL bLaunchAndGo, bLaunchAndWait, bExit; NUMBER nWait; begin Enable (BACKGROUND); Enable (DEFWINDOWMODE); Disable (BACKBUTTON); AskOptions (EXCLUSIVE, "Test", LAUNCH_WAIT_TEXT, bLaunchAndWait, LAUNCH_GO_TEXT, bLaunchAndGo, EXIT_TEXT, bExit); if !bExit then if bLaunchAndWait then nWait = WAIT; else nWait = NOWAIT; endif; if (LaunchAppAndWait (PROGRAM, "", nWait) < 0) then MessageBox ("Unable to launch " + PROGRAM + ".",SEVERE); endif; MessageBox ("Setup will now exit.", INFORMATION); endif; end; ``` -------------------------------- ### InstallShield Script: Finish Setup Source: https://docs.revenera.com/installshield/LangRef/LangrefFeatureMoveData_example Completes the installation process by updating the progress bar, creating program folder icons, disabling status indicators, and displaying a completion message. It also offers the option to view the Readme file. ```InstallScript /*--------------------------------------------------------------------------*\ * Function: FinishSetup() * Purpose: This function finishes the installation. The main reason for * abstracting this process into this function is to make it * easy to see the function calls this sample script demonstrates. \*--------------------------------------------------------------------------*/ function FinishSetup() begin // Indicate the final percentage the progress bar is to show when the // following file transfer operation is complete. StatusUpdate(ON, 99); // Increment progress bar to 99% for creation of Start Programs menu icon. SetStatusWindow (96 , ADDINGICON); // Add the APP_NAME icon to the DEFAULT_FOLDER_NAME folder. szProgram = INSTALLDIR ^ PROGRAMDIR ^ MAIN_EXE; LongPathToQuote (szProgram, TRUE); AddFolderIcon (DEFAULT_FOLDER_NAME, APP_NAME, szProgram, INSTALLDIR ^ PROGRAMDIR, "", 0, "", REPLACE); Delay (1); // Disable the progress indicator and its settings. Disable (INDVFILESTATUS); Disable (STATUSDLG); // Announce installation complete and offer to view Readme file. MessageBox (COMPLETE_MSG, INFORMATION); end; ``` -------------------------------- ### Launch Application Example - InstallScript Source: https://docs.revenera.com/installshield/helplibrary/LaunchingInstallFromInstallScriptInstall Demonstrates how to launch a child installation from a parent InstallScript installation using the LaunchApplication function. This example assumes the child installation files are on a CD-ROM. It uses SRCDISK as the source directory and SW_HIDE to hide the launched setup window. ```InstallScript LaunchApplication (SRCDISK ^ "Launched Setup Folder\\Setup.exe", "", "", SW_HIDE, "", LAAW_OPTION_WAIT); ``` -------------------------------- ### InstallScript Welcome Function Example Source: https://docs.revenera.com/installshield/LangRef/LangrefWelcome_example This InstallScript code demonstrates the usage of the `Welcome` function to display a welcome dialog. It includes necessary definitions and function prototypes for InstallShield. The function returns a negative value if the dialog fails. ```InstallScript #define PRODUCT "ExampleProduct" // Include Ifx.h for built-in InstallScript function prototypes. #include "Ifx.h" export prototype ExFn_Welcome(HWND); function ExFn_Welcome(hMSI) STRING svLogFile; begin SdProductName ( PRODUCT ); // Display the Welcome dialog. if (Welcome ("Welcome Dialog Example", 0) < 0) then MessageBox ("Welcome dialog failed.", SEVERE); endif; end; ``` -------------------------------- ### InstallScript Example: Enumerate and Select Setup Types Source: https://docs.revenera.com/installshield/LangRef/LangrefFeatureSetupTypeEnum_example This InstallScript code demonstrates how to use the FeatureSetupTypeEnum function to get a list of setup types available in the InstallShield media. It then displays these types in an informational list and a selection dialog. This requires a project with defined setup types and the DEFTYPE macro set to one of them. ```InstallScript #define SDSHOWTITLE "Setup Type Enumeration" #define SDSHOWMSG MEDIA + " media's enumerated setup types are:" #define SETUPTITLE "Setup Type Selection" #define SETUPMSG "Select a setup type." #define DEFTYPE "Typical" #include "Ifx.h" export prototype ExFn_FeatureSetupTypeEnum(HWND); function ExFn_FeatureSetupTypeEnum(hMSI) LIST listID; STRING svSetupType; begin // Disable the Back button in setup dialogs. Disable (BACKBUTTON); // Create a list to store setup types. listID = ListCreate ( STRINGLIST ); // Get the setup type names from the media into the list. if (FeatureSetupTypeEnum( MEDIA, listID) < 0 ) then MessageBox ("FeatureSetupTypeEnum failed.", WARNING); endif; // Display the setup types. SdShowInfoList (SDSHOWTITLE, SDSHOWMSG, listID); // Now show setup types in a selection dialog. svSetupType = DEFTYPE; SdSetupTypeEx (SETUPTITLE, SETUPMSG, "", svSetupType, 0); // Release the list from memory. ListDestroy (listID); end; ``` -------------------------------- ### Get Package Exit Code using Object Expression Source: https://docs.revenera.com/installshield/helplibrary/SteObjectExp This example shows how to use the Package object expression to obtain the exit code of a scheduled package identified by its GUID. This is essential for error handling and verifying the success of package installations. ```InstallScript [@Parcel(0F283EC0-E9D1-4D18-801D-0014F6CA96DF).ExitCode] ``` -------------------------------- ### Create and Write to File using InstallScript Source: https://docs.revenera.com/installshield/LangRef/LangrefCreateFile_Example This InstallScript example demonstrates creating a file, writing a string to it using WriteLine, and then closing the file. It requires the EXAMPLE_DIR preprocessor constant to be set and will overwrite existing files. Error handling for CreateFile and WriteLine is included. ```InstallScript #define EXAMPLE_DIR "C:\\" #define EXAMPLE_FILE "ISExampl.txt" #include "Ifx.h" export prototype ExFn_CreateFile(HWND); function ExFn_CreateFile(hMSI) STRING szTitle, szMsg; NUMBER nvFileHandle; begin // Set the file mode to append. OpenFileMode (FILE_MODE_APPEND); // Create a new file and leave it open. if (CreateFile (nvFileHandle, EXAMPLE_DIR, EXAMPLE_FILE) < 0) then // Report the error. MessageBox ("CreateFile failed.", SEVERE); abort; else // Set the message to write to the file. szMsg = "This line was appended by an example InstallShield script."; // Append the message to the file. if (WriteLine(nvFileHandle, szMsg) < 0) then // Report the error. MessageBox ("WriteLine failed.", SEVERE); else // Report success. szTitle = "CreateFile & WriteLine"; szMsg = "Successfully created and wrote to %s."; SprintfBox (INFORMATION, szTitle, szMsg, EXAMPLE_FILE); endif; endif; // Close the file. CloseFile (nvFileHandle); end; ``` -------------------------------- ### Launch Executable After Installation - InstallScript Source: https://docs.revenera.com/installshield/helplibrary/FAQCustomActionsLaunchExe The LaunchApplication function starts an executable file. This example launches Program.exe from the user's installation directory and waits for it to close before returning control to the script. InstallScript projects use TARGETDIR instead of INSTALLDIR. ```InstallScript LaunchApplication (INSTALLDIR ^ "Program.exe", "", "", SW_NORMAL, "", LAAW_OPTION_WAIT); ``` -------------------------------- ### InstallScript Example for RegDBSetAppInfo and RegDBGetAppInfo Source: https://docs.revenera.com/installshield/LangRef/LangrefRegDBGetAppInfo_example This InstallScript code demonstrates setting and retrieving application information using RegDBSetAppInfo and RegDBGetAppInfo. It requires calling InstallationInfo and DeinstallStart beforehand. The snippet includes error handling and compares retrieved values with set values for strings and sizes. ```InstallScript #define COMPANY_NAME "Example_Company" #define PRODUCT_NAME "Example_App" #define PRODUCT_VERSION "5.0" #define PRODUCT_KEY "EXAMPLE.EXE" #define DEINSTALL_KEY "Example_DeinstKey" #define UNINSTALL_NAME "Example_App_5.0" #define DEFAULT_LOG_PATH "EXAMPLE" #define TITLE "RegDBGetAppInfo" #include "Ifx.h" export prototype ExFn_RegDBGetAppInfo(HWND); function ExFn_RegDBGetAppInfo(hMSI) STRING szStrName, szStrValue, svStrValue, szTitle, szMsg, svLogFile; NUMBER nvSize, nvType; begin RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); szStrName = "ExampleStringValue"; szStrValue = "ExampleStringSetting"; InstallationInfo (COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY); DeinstallStart(DEFAULT_LOG_PATH, svLogFile, DEINSTALL_KEY, 0); if (RegDBSetAppInfo (szStrName, REGDB_STRING, szStrValue, -1) < 0) then MessageBox ("Failed to set key and value of REGDB_STRING type.", SEVERE); abort; endif; if (RegDBGetAppInfo (szStrName, nvType, svStrValue, nvSize) < 0) then MessageBox ("Failed to get application information value.", SEVERE); abort; else if (nvType != REGDB_STRING) then MessageBox ("Type comparison failed.", WARNING); endif; if (szStrValue != svStrValue) then MessageBox ("Sub key value comparison Failed.", WARNING); else szMsg = "Set values: %s = %s\n\nReturn values: %s = %s"; SprintfBox (INFORMATION, TITLE, szMsg, szStrName, szStrValue, szStrName, svStrValue); endif; if (nvSize != StrLength(szStrValue)) then MessageBox ("Size Comparison failed.", WARNING); else szMsg = "Size in bytes entered: %d\n\nSize in bytes returned: %d"; SprintfBox (INFORMATION, TITLE, szMsg, nvSize, StrLength(szStrValue) + 1); endif; endif; end; ``` -------------------------------- ### SdFinish Dialog Example in InstallScript Source: https://docs.revenera.com/installshield/LangRef/LangrefSdFinish_example This InstallScript code demonstrates the usage of the SdFinish dialog. It configures product name and messages, then displays the dialog to the user. Post-dialog actions include launching an application to view a README file or showing a placeholder message for launching the main application. Requires preprocessor constants for NOTEPAD and READMEFILE to be set. ```InstallScript #define NOTEPAD WINDIR ^ "Notepad.exe" #define READMEFILE SUPPORTDIR ^ "ReadMe.txt" #include "Ifx.h" function OnBegin() STRING szProductName, szTitle; STRING szMsg1, szMsg2, szOpt1, szOpt2; BOOL bvOpt1, bvOpt2; NUMBER nReturn; begin // Set the product name to substitute for the %P place holder. szProductName = "My Application"; SdProductName (szProductName); // Setup parameters that will be passed to SdFinish. szTitle = "SdFinish Example"; szMsg1 = "%P Setup is almost complete.\n" + "Choose the options you want below."; szMsg2 = "Click Finish to complete %P Setup."; szOpt1 = "I would like to view the README file."; szOpt2 = "I would like to launch %P."; // Display the SdFinish dialog. SdFinish (szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2); if (bvOpt1) then // Display the read me file. LaunchAppAndWait (NOTEPAD, READMEFILE, WAIT); endif; if (bvOpt2) then // Because this example does not actually install an // application, a message box is displayed in place of // the call to LaunchApp that would normally be made here, // for example: // LaunchApp (TARGETDIR ^ "MyApp.exe",""); SprintfBox (INFORMATION, szTitle, "Launch %s here.", szProductName); endif; end; ``` -------------------------------- ### SdFeatureDialogAdv Example in InstallScript Source: https://docs.revenera.com/installshield/LangRef/LangrefSdFeatureDialogAdv_example This InstallScript example demonstrates how to use the SdFeatureDialogAdv function to present users with a dialog box. This dialog lists available setup features and their disk space requirements, allowing users to make installation choices. It requires a project with defined features, subfeatures, and components containing files. ```installscript #include "Ifx.h" function OnBegin() STRING szTitle, szMsg, svDir; begin svDir = TARGETDIR; szTitle = "Select Features"; szMsg = "Select the features you want to install on your computer."; // Display all top-level features available. SdFeatureDialogAdv (szTitle, szMsg, svDir, ""); end; ``` -------------------------------- ### InstallScript Feature Validation Example Source: https://docs.revenera.com/installshield/LangRef/LangrefFeatureValidate_example This InstallScript example demonstrates how to use various functions to manage user interaction during installation. It includes displaying setup types, feature selection dialogs, and validating passwords for protected features. The script requires a specific project structure with features, subfeatures, and components as detailed in the notes. ```InstallScript /*--------------------------------------------------------------*\ * * InstallShield Example Script * * Demonstrates the functions SdSetupTypeEx, SdFeatureDialog, * FeatureIsItemSelected, FeatureGetData, and FeatureValidate. * * Notes: To run this example script, create a project with * the following features (f), subfeatures (sf), * and components (c): * * (f) Program Files * (c) Program DLLS * (c) Program EXEs * (f) Example Files * (sf) Small Documents * (c) Small Document Examples * (sf) Books * (c) Book Examples * (sf) Graphics * (c) Graphic Examples * (f) Help Files * (c) Help Files * (f) Utilities * (sf) Grammar Checker * (c) Grammar Checker * (sf) Art Studio * (c) Art Studio * (f) Evaluation Copy * (c) Evaluation Copy * (c) Help Files * * Insert "dummy" files into the components. Make sure you * define the correct file name for the main EXE (MAIN_EXE, * below) that you insert into the Program EXEs components. * Run the setup with and without a password assigned to the * Program Files feature (remember to rebuild your media * each time). * * You can also create billboards (name them Bbrd1.bmp, * Bbrd2.bmp, and Bbrd3.bmp) and add them to the project in * the Support Files/Billboards's Language Independent folder. * * This example script installs files, adds an icon to the * Start Programs menu, and provides uninstallation * functionality. * \*--------------------------------------------------------------*/ // Define strings. In a real installation, you would define these in the String Editor // view and precede each string identifier in the script with the at symbol (@). #define FEATURE_SELECT_TITLE "Select Features" #define FEATURE_SELECT_MSG "Select features and subfeatures to install." #define FEATURE_PROGRAMFILES_DISPLAYNAME "Program Files" #define PASSWORD_PROMPT "Please enter the password." #define PASSWORD_ERRMSG "Password incorrect. Please enter again." // Global variable declarations. STRING svData, svLogFile, szProgram, szFeature, svResult, svSetupType, svDir; BOOL bInitStepsDone, bPwdValid; NUMBER nvData, nResult; #include "ifx.h" function OnFirstUIBefore() begin // Disable the Back button in setup dialogs. Disable (BACKBUTTON); // Get the setup type. svDir = TARGETDIR; SdSetupTypeEx (SETUPTYPE_TITLE, SETUPTYPE_MSG, "", svSetupType, 0); // If user selected Custom setup type, display feature selection dialog. if (svSetupType = SETUPTYPE_CUSTOM) then SdFeatureDialog (FEATURE_SELECT_TITLE, FEATURE_SELECT_MSG, svDir, ""); endif; // Enable the Back button in setup dialogs. Enable (BACKBUTTON); // If the Program Files feature is selected and there is a password // associated with it, the user must input the password and // it must be validated. nResult = FALSE; nvData = FALSE; nResult = FeatureIsItemSelected (MEDIA, FEATURE_PROGRAMFILES_DISPLAYNAME); FeatureGetData (MEDIA, FEATURE_PROGRAMFILES_DISPLAYNAME, FEATURE_FIELD_PASSWORD, nvData, svData); if (nResult && nvData) then bPwdValid = FALSE; Disable (BACKBUTTON); // Back button not needed or supported here. while (!bPwdValid) AskText (PASSWORD_PROMPT, "", svResult); nResult = FeatureValidate (MEDIA, FEATURE_PROGRAMFILES_DISPLAYNAME, svResult); if (nResult = 0) then bPwdValid = TRUE; else MessageBox (PASSWORD_ERRMSG, SEVERE); endif; endwhile; Enable (BACKBUTTON); // Restore Back button's default status. endif; end; ``` -------------------------------- ### InstallScript PathFind, PathSet, and PathGet Example Source: https://docs.revenera.com/installshield/LangRef/LangrefPathFind_example This InstallScript code demonstrates how to use PathSet to define a search path, PathFind to locate specific subdirectories (like 'BIN') within that path, and PathGet to retrieve the final path buffer. It includes error handling and message boxes to show the results of each function call. This script is intended to be called as a custom action in a Basic MSI setup. ```InstallScript #include "Ifx.h" export prototype ExFn_PathFind(HWND); function ExFn_PathFind(hMSI) STRING szString, szMsg, svResult, svString, szDir; NUMBER nResult; BOOL bDir, bSearch; begin // Set up the search path to pass as a parameter to PathSet. szString = "C:\\DOS;C:\\USERS\\BIN;C:\\MSC\\BIN;"; // Place the search path into the path buffer if (PathSet (szString) < 0) then // Report an error; then terminate. MessageBox ("PathSet failed.", SEVERE); abort; else szMsg = "PathSet set the path buffer to: %s"; SprintfBox (INFORMATION, "PathSet Example", szMsg, szString); endif; // Set PathFind variables. szDir = "BIN"; // Search the path buffer for paths that include a folder named "BIN". nResult = PathFind(szDir, svResult, PARTIAL, RESTART); // Error check PathFind. if (nResult < 0) then MessageBox("PathFind failed.", SEVERE); abort; endif; // Loop through the string to find all occurrences of the szDir string. while (nResult = 0) SprintfBox(INFORMATION, "PathFind example", "Search for %s.\n\nFound: %s", szDir, svResult); nResult = PathFind(szDir, svResult, PARTIAL, CONTINUE); endwhile; // Get the contents of the path buffer. if (PathGet (svString) < 0) then MessageBox ("PathGet failed.", SEVERE); else // Display the path string. SprintfBox (INFORMATION, "Path Get Example", "Path is: %s", svString); endif; end; ``` -------------------------------- ### InstallScript StrFind Example Source: https://docs.revenera.com/installshield/LangRef/LangrefStrFind_example This InstallScript code demonstrates the usage of the StrFind function. It searches for a specific substring within a larger string and reports the starting byte position if found, or a message indicating that the substring was not found. This functionality is useful for text manipulation within installer scripts. ```InstallScript #define TITLE_TEXT "StrFind Example"; // Include Ifx.h for built-in InstallScript function prototypes. #include "Ifx.h" export prototype ExFn_StrFind(HWND); function ExFn_StrFind(hMSI) STRING szString, szFindMe, szTitle, szMsg; NUMBER nLocation; begin // Set up parameters for call to StrFind. szString = "This is a sample string to be searched."; szFindMe = "Sample String"; // Find the substring specified by szFindMe. nLocation = StrFind (szString, szFindMe); // Display the location of the text if it was found. if (nLocation < 0) then MessageBox (szFindMe + " not found in " + szString + ".", WARNING); else szMsg = "'%s' starts at byte %d of\n'%s'"; SprintfBox (INFORMATION, szTitle, szMsg, szFindMe, nLocation, szString); endif; end; ``` -------------------------------- ### LaunchApp Function Example in InstallScript Source: https://docs.revenera.com/installshield/LangRef/LangrefLaunchApp_example This InstallScript code demonstrates the usage of the `LaunchApp` function to execute the Windows Notepad application and open a specified text file. It includes error handling to display a message if the application fails to launch. Ensure the `APPLICATION` and `CMD_LINE` preprocessor constants are correctly set to valid paths on the target system. ```InstallScript #define APPLICATION WINDIR^"Notepad.exe" #define CMD_LINE WINDIR^"Readme.txt" // Include Ifx.h for built-in InstallScript function prototypes. #include "Ifx.h" export prototype ExFn_LaunchApp(HWND); function ExFn_LaunchApp(hMSI) begin // Launch the Windows Notepad application to edit // the Windows Readme.txt file. if (LaunchApp (APPLICATION, CMD_LINE) < 0) then MessageBox ("Unable to launch "+ APPLICATION+".", SEVERE); endif; end; ``` -------------------------------- ### InstallScript SdInit and SdFeatureDialog2 Example Source: https://docs.revenera.com/installshield/LangRef/LangrefSdInit_example This InstallScript code demonstrates the usage of SdInit and SdFeatureDialog2. SdInit initializes the setup for dialog functions. SdFeatureDialog2 is used to display a feature selection dialog. This snippet is specific to InstallScript. ```InstallScript #include "Ifx.h" function OnBegin() STRING szInfoString; begin // Initialize setup for calls to Sd dialog functions. SdInit (); // Set check box style for feature selection. DialogSetInfo ( DLG_INFO_CHECKSELECTION, szInfoString, CHECKBOX ); // Get feature selections. SdFeatureDialog2 ( "", "", TARGETDIR, "" ); end; ``` -------------------------------- ### InstallScript OnCanceling Event Handler for Setup Cancellation Source: https://docs.revenera.com/installshield/LangRef/LangrefOnCanceling The OnCanceling event handler is used in InstallScript to manage the setup cancellation process. It is triggered when a user clicks the Cancel button in a dialog. This example shows how to display a confirmation dialog to the user before aborting the installation. ```InstallScript function OnCanceling( ) begin if (YES = AskYesNo( "Are you sure you want to cancel the setup?", YES)) then abort; endif; end; ``` -------------------------------- ### InstallScript SetupType and Feature Handling Example Source: https://docs.revenera.com/installshield/LangRef/LangrefSetupType_example This InstallScript code demonstrates the SetupType function to allow users to choose a setup type (Typical or Custom). If Custom is selected, it presents a feature selection dialog. It also configures uninstallation information and handles file transfers based on feature selections, including error reporting. ```InstallScript /*--------------------------------------------------------------*\n*\n* InstallShield Example Script\n*\n* Demonstrates the SetupType function.\n*\n* Comments: To run this example script, create a project (or\n* insert into a project) with several features and\n* subfeatures with components containing files.\n* This example includes setup of uninstallation\n* functionality.\n*\n\*--------------------------------------------------------------*/ // Specify your feature name here. These are the names you gave to your // features in the IDE. A NULL ("" ) string specifies base features. #define ASKDESTTITLE "Choose Destination Location" #define ASKDESTMSG "Choose a destination location for the application." #define SETUPTYPETITLE "Choose Setup Type" #define SETUPTYPEMSG "Select a setup type." #define FEATURE "" #define SDFEATDLGTITLE "Feature Selection" #define SDFEATDLGMSG "Select features to install and destination location." #define APPBASE_PATH "Your Company\\Word Processor" #define COMPANY_NAME "Your Company" #define PRODUCT_NAME "Word Processor" #define PRODUCT_VERSION "1.0" #define PRODUCT_KEY "Word Processor" #define DEINSTALL_KEY "Word Processor" prototype HandleFeatureError (NUMBER); // Include Ifx.h for built-in InstallScript function prototypes. #include "Ifx.h" export prototype ExFn_SetupType(HWND); function ExFn_SetupType(hMSI) STRING svLogFile; NUMBER nvDisk, nResult; begin // Disable the Back button in setup dialogs. Disable (BACKBUTTON); // Get the destination location. INSTALLDIR = PROGRAMFILES ^ APPBASE_PATH; AskDestPath (ASKDESTTITLE, ASKDESTMSG, INSTALLDIR , 0); // Get setup type and target location with SdSetupType. INSTALLDIR = PROGRAMFILES ^ APPBASE_PATH; nResult = SetupType (SETUPTYPETITLE, SETUPTYPEMSG, "", TYPICAL, 0); // If Custom setup type is selected, let user select features // and change location if desired. if (nResult = CUSTOM) then SdFeatureDialogAdv (SDFEATDLGTITLE, SDFEATDLGMSG, INSTALLDIR, FEATURE); endif; // Set up uninstallation. InstallationInfo (COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY); svLogFile = "Uninst.isu"; DeinstallStart (INSTALLDIR, svLogFile, DEINSTALL_KEY, 0); RegDBSetItem (REGDB_UNINSTALL_NAME, UNINSTALL_NAME); // Transfer files based on feature selection. Handle errors. Enable (STATUSDLG); Enable (INDVFILESTATUS); StatusUpdate (ON, 100); nResult = FeatureMoveData (MEDIA, nvDisk, 0); HandleFeatureError (nResult); Disable (INDVFILESTATUS); Disable (STATUSDLG); end; /*--------------------------------------------------------------------------*\n*\n* Function: HandleFeatureError\n*\n* Purpose: This function evaluates the value returned by a feature\n* function and if the value is less than zero, displays the error\n* number and aborts the setup.\n*\n\*--------------------------------------------------------------------------*/ function HandleFeatureError (nResult) NUMBER nvError; STRING svFeatureSource, svFeature, svComponent, svFile; begin if (nResult < 0) then ComponentError (svFeatureSource, svFeature, svComponent, svFile, nvError); SprintfBox (INFORMATION, "Data Transfer Error Information", "FeatureError returned the " + "following data transfer error.\n" + "Setup will now abort.\n\n" + "Media Name: %s\nFeature: %s\nComponent: %s\n" + "File: %s\nError Number: %ld", svFeatureSource, svFeature, svComponent, svFile, nvError); abort; endif; end; ``` -------------------------------- ### InstallShield Script: Initialize Uninstallation Source: https://docs.revenera.com/installshield/LangRef/LangrefFeatureMoveData_example Initializes the uninstallation process by setting required installation information and starting the uninstallation log. This includes defining company, product, and version details, and configuring the log file. ```InstallScript if (AskDestPath ("", "", INSTALLDIR, 0) != BACK) then bInitStepsDone = TRUE; endif; endwhile; // Set installation information required for registry entries and for // the following call to DeinstallStart. InstallationInfo (COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY); // Initialize the uninstallation log file, including registry entry. svLogFile = "Uninst.isu"; DeinstallStart (INSTALLDIR, svLogFile, DEINSTALL_KEY, 0); RegDBSetItem (REGDB_UNINSTALL_NAME, UNINSTALL_NAME); end; ```