Displaying Dialogs During InstallScript and InstallScript MSI Installations

InstallShield 2022

Project:This information applies to the following project types:

InstallScript
InstallScript MSI

Most of the user interface of an InstallScript or InstallScript MSI installation is defined in event handlers such as OnFirstUIBefore and OnFirstUIAfter. The following sample InstallScript code in OnFirstUIBefore is for the SdWelcome and SdLicense2 dialogs:

Dlg_SdWelcome:

    szTitle = "";

    szMsg = "";

    nResult = SdWelcome( szTitle, szMsg );

    if (nResult = BACK) goto Dlg_Start;

 

Dlg_SdLicense2:

    szTitle = "";

    szOpt1 = "";

    szOpt2 = "";

    szLicenseFile = SUPPORTDIR ^ "License.rtf";

    nResult = SdLicense2Ex( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted, TRUE );

    if (nResult = BACK) then

        goto Dlg_SdWelcome;

    else

        bLicenseAccepted = TRUE;

    endif;

Every dialog function returns a constant indicating which button the end user clicked to exit the dialog. To handle the end user clicking the Back button on a dialog, directly after the dialog is an if statement that compares the dialog’s return value to the constant BACK, using a goto statement to jump to a label just before the previous dialog. In the aforementioned code example, if the end user clicks the Back button on the SdLicense2 dialog, the goto statement jumps to the Dlg_SdWelcome label, and the SdWelcome dialog is displayed to the end user. Therefore, if you insert a dialog function between two dialogs such as SdWelcome and SdLicense2, you need to adjust the if statements, labels, and goto statements as appropriate.

To display a dialog to the end user as part of the installation’s user interface:

1. In the View List under Behavior and Logic, click InstallScript.
2. Add the dialog function to the appropriate script event handler.
3. Modify the dialog function’s parameters according to how you want the dialog to behave.

To learn about the available parameters, refer to the dialog function documentation:

Dialog Functions
Dialog Customization Functions
4. Use the script to direct the flow of the dialogs—for example, by using if and goto statements.

See Also