SdShowFileMods Example

InstallShield 2019 » InstallScript Language Reference

Project • This information applies to the following project types:

InstallScript
InstallScript MSI

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

*

* InstallShield Example Script

*

* Demonstrates the SdShowFileMods function.

*

* This script displays a list of changes to make to a specified

* file.  The user may elect to make those changes, to save the

* changes to a new file, or not to make or save the changes.

*

* Note: SdShowFileMods does not itself modify or create files.

*       It simply obtains the user's choice.

*

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

 

#include "Ifx.h"

 

function OnBegin()

   STRING szTitle, szMsg, szTargetFile, szAltFile;

   NUMBER nvSelection;

   LIST   listID;

begin

 

   // Disable the Back button in setup dialogs.

   Disable (BACKBUTTON);

 

   // Set up variables for call to SdShowFileMods.

   szTitle = "SdShowFileMods Example";

 

   szMsg = "Choose what option to take";

   szTargetFile = "Example.txt";

   szAltFile = "Example.new";

 

   // Create a list to hold file modification details.

   listID = ListCreate (STRINGLIST);

 

   // Add file modification details to the list.

   ListAddString (listID, "PATH = C:\\Example", AFTER);

   ListAddString (listID, "FILES = 40", AFTER);

 

   // Present options and get the user's choice.

   SdShowFileMods (szTitle, szMsg, szTargetFile, szAltFile,

                   listID, nvSelection);

 

   // Handle the user's selection.

   switch(nvSelection)

 

      case 101:

         SprintfBox (INFORMATION, szTitle, "Setup modified the %s file.",

                     szTargetFile);

 

      case 102:

         SprintfBox (INFORMATION, szTitle, "The required changes were saved " +

                     "to the %s file.", szAltFile);

 

      case 103:

         SprintfBox (INFORMATION, szTitle, "No changes were made.");

 

   endswitch;

 

end;