InstallShield 2015 ยป InstallScript Language Reference
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the functions FeatureSetupTypeGetData,
* FeatureGetData, FeatureSetData, SdFeatureDialog2,
* and FeatureSelectItem.
*
* 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
*
* Be sure to enter descriptions into the Description fields of
* the feature properties sheets for the Program_Files and
* Example_Files features and their subfeatures.
*
\*--------------------------------------------------------------*/
// 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 FEAT_SELECT_TITLE "Select Features"
#define FEAT_SELECT_MSG1 "IMPORTANT! Note the various feature"
#define FEAT_SELECT_MSG2 "and subfeature names, descriptions,"
#define FEAT_SELECT_MSG3 "and selection settings."
#define FEAT_SELECT_MSG4 "IMPORTANT! Note the CHANGED feature"
#define FEAT_SELECT_MSG5 "and subfeature name, description, "
#define FEAT_SELECT_MSG6 "and selection settings."
#define FEAT_PROGRAMFILES_DISPLAYNAME "Program Files"
#define FEAT_EXAMPLEFILES_DISPLAYNAME "Example Files"
#define FEAT_SMALLDOCUMENTS_DISPLAYNAME "Small Documents"
#define FEAT_BOOKS_DISPLAYNAME "Books"
#define FEAT_GRAPHICS_DISPLAYNAME "Graphics"
#define SETUP_TYPE "Typical"
// Global variable declarations.
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_FeatureSetupTypeGetData(HWND);
function ExFn_FeatureSetupTypeGetData(hMSI)
STRING svInfo, szInfo, szFeature;
NUMBER nvInfo, nInfo, nResult;
begin
// Get the description field data for the SETUP_TYPE setup type.
FeatureSetupTypeGetData (MEDIA, SETUP_TYPE, SETUPTYPE_INFO_DESCRIPTION,
nvInfo, svInfo );
SprintfBox (INFORMATION, "FeatureSetupTypeGetData demo",
"FeatureSetupTypeGetData got the following " +
"value from the " + SETUP_TYPE + " description field:\n\n%s",
svInfo);
// Get the description field data for the FEAT_PROGRAMFILES_DISPLAYNAME
// feature using FeatureGetData.
szFeature = FEAT_PROGRAMFILES_DISPLAYNAME;
nResult = FeatureGetData (MEDIA, szFeature, FEATURE_FIELD_DESCRIPTION,
nvInfo, svInfo);
SprintfBox (INFORMATION, "FeatureGetData demo",
"FeatureGetData got the following value " +
"from the " + FEAT_PROGRAMFILES_DISPLAYNAME +
" description field:\n\n%s", svInfo);
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
// Show the original description field values
// in the feature selection dialog.
SdFeatureDialog2 (FEAT_SELECT_TITLE, FEAT_SELECT_MSG1 + FEAT_SELECT_MSG2 +
FEAT_SELECT_MSG3, INSTALLDIR, "");
// Change the displayed names for the Program_Files feature and the
// Example_Files feature and subfeatures.
szInfo = "CHANGED Feature Name!";
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DISPLAYNAME,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DISPLAYNAME,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME + "\\" +
FEAT_SMALLDOCUMENTS_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DISPLAYNAME,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME + "\\" +
FEAT_BOOKS_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DISPLAYNAME,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME + "\\" + FEAT_GRAPHICS_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DISPLAYNAME,
nInfo, szInfo);
// Change the descriptions displayed for the Program_Files feature
// and the Example_Files feature and subfeatures.
szFeature = FEAT_PROGRAMFILES_DISPLAYNAME;
szInfo = "CHANGED description field value!";
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DESCRIPTION,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DESCRIPTION,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME + "\\" +
FEAT_SMALLDOCUMENTS_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DESCRIPTION,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME + "\\" + FEAT_BOOKS_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DESCRIPTION,
nInfo, szInfo);
szFeature = FEAT_EXAMPLEFILES_DISPLAYNAME + "\\" + FEAT_GRAPHICS_DISPLAYNAME;
nResult = FeatureSetData (MEDIA, szFeature, FEATURE_FIELD_DESCRIPTION,
nInfo, szInfo);
// Deselect the Program_Files and Example_Files features (and all their
// subfeatures, by extension).
FeatureSelectItem (MEDIA, FEAT_PROGRAMFILES_DISPLAYNAME, FALSE);
FeatureSelectItem (MEDIA, FEAT_EXAMPLEFILES_DISPLAYNAME, FALSE);
// Display the features again, noting the changed names, descriptions,
// and selection settings.
SdFeatureDialog2 (FEAT_SELECT_TITLE, FEAT_SELECT_MSG4 + FEAT_SELECT_MSG5 +
FEAT_SELECT_MSG6, INSTALLDIR, "");
end;
InstallShield 2015 Help LibraryJune 2015 |
Copyright Information | Contact Us |