SdStartCopy Example

InstallShield 2019 » InstallScript Language Reference

Project • This information applies to the following project types:

InstallScript
InstallScript MSI

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the function SdStartCopy, with the use of

* SdRegisterUserEx and SdSetupType.

*

* SdRegisterUserEx and SdSetupType are called to collect

* installation information from the user.  The information is

* stored in a list and displayed by SdStartCopy.

*

\*--------------------------------------------------------------*/

 

#include "Ifx.h"

 

function OnBegin()

    STRING  szTitle, szMsg, svName, svCompany, svSerial, svDir, svSetupType;

    LIST    listData;

    NUMBER  nResult;

begin

 

start:

    // Create the list.

    listData = ListCreate (STRINGLIST);

    

    // Set up message parameter for call to SdRegisterUserEx.

    szMsg = "Please enter your name, company, and serial no.";

    

    // Retrieve registration information.

    SdRegisterUserEx ("Registration", szMsg, svName, svCompany, svSerial);

    

    // Add the information to the list.

    ListAddString (listData, "User Information: ", AFTER);

    ListAddString (listData, "          " + svName, AFTER);

    ListAddString (listData, "          " + svCompany, AFTER);

    ListAddString (listData, "          " + svSerial, AFTER);

    ListAddString (listData, "", AFTER);

 

SetupTypeLabel:

   // Set up parameters for call to SdSetupType.

    szMsg = "Choose the type of installation by clicking one of the buttons.";

    svDir = TARGETDIR;

 

    // Retrieve setup type and directory information.

    nResult = SdSetupType("Select Setup Type", szMsg, svDir, 0);

 

    // Create a string that describes the selected setup type.

    switch (nResult)

        case TYPICAL:

            svSetupType = "TYPICAL: Application will be installed " +

                          "with the most common options.";

        case COMPACT:

            svSetupType = "COMPACT: Application will be installed " +

                          "with the minimum required options.";

        case CUSTOM:

            svSetupType = "CUSTOM: You select the options that you " +

                          "want installed.";

        case BACK:

            goto start;

        default:

            MessageBox ("Invalid setup type selection!", SEVERE);

            abort;

    endswitch;

 

    // Add the setup type information to the list.

    ListAddString(listData, "Setup Type:", AFTER);

    ListAddString(listData, "              " + svSetupType, AFTER);

    ListAddString(listData, "", AFTER);

    ListAddString(listData, "Destination Directory:", AFTER);

    ListAddString(listData, "              " + svDir, AFTER);

 

    // Set up title and message parameters for call to SdStartCopy.

    szTitle = "SdStartCopy Example";

    szMsg   = "Setup has enough information to begin the file-transfer\n" +

              "operation.  If you want to review or change any of the\n" +

              "settings, click Back.  If you are satisfied with the\n" +

              "settings, click Next to begin copying files.";

 

    // Call SdStartCopy to display user selections.

    nResult = SdStartCopy (szTitle, szMsg, listData);

 

    // Handle the user's exit from the SdStartCopy dialog.

    switch(nResult)

        case NEXT:

            MessageBox ("SdStartCopy successful.",INFORMATION);

        case BACK:

            goto SetupTypeLabel;

        default:

            MessageBox ("SdStartCopy failed.", SEVERE);

    endswitch;

 

end;