cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rogereeno
Level 3

InstallScript Project: Determine Selected Features

Hello, I am an InstallShield newbie. I've searched for hours for a satisfactory answer to no avail.

I created an "InstallScript" type project (not "InstallScript MSI") and am attempting to determine features that were selected by the user in the SdFeatureTree dialog for a new installation. I discovered that FeatureIsItemSelected only determines which features are currently installed - which is not what I want. I am not sure if FeatureGetData( MEDIA, "FeatureName", FEATURE_FIELD_SELECTED, ...) is supposed to determine if a feature is currently installed or is selected in the SdFeatureTree dialog. If it is the latter, it does not seem to work. Here is my InstallScript code:

	szTitle = "";
szMsg = "";
nLevel = 2;
nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );

if ( nResult = BACK )
then
goto Dlg_SetupType2;
else
FeatureGetData( MEDIA, "FeatureName", FEATURE_FIELD_SELECTED, nResult, szResult );

if ( nResult = TRUE )
then
MessageBox( "FeatureName selected", MB_OK );
else
MessageBox( "FeatureName NOT selected", MB_OK );
endif;
endif;


I always receive the "NOT selected" message box, regardless of whether or not "FeatureName" is selected in the SdFeatureTree dialog. Am using the feature names specified at each node by the Feature Tree View, not the display names.

Thank you!

- Roger
Labels (1)
0 Kudos
(2) Replies
ch_eng
Level 7

Roger,

I do use FeatureIsItemSelected in my InstallScript Only project to determine if a user has checked a feature for installation. Here's an example. I store the results in boolean variables since I reference it several times later on.

Dlg_SdFeatureTree:
szTitle = "";
szMsg = "";
if (nSetupType = CUSTOM) then
nResult = SdFeatureTree(szTitle, szMsg, TARGETDIR, "", 2);
if (nResult = BACK) goto Dlg_SetupType;
// internal names of features that can be installed; must correspond with
// those listed in Organization\Features
bInstallDATABASE = ( FeatureIsItemSelected( MEDIA, "Database" ) = 1 );
bInstallWEBSITE = ( FeatureIsItemSelected( MEDIA, "WebSite" ) = 1 );
svInstallFailMsg = "";
if ( bInstallWEBSITE ) then
// user has chosen a feature that requires .NET Framework 4.0
if bvHasDotNet4 then
// user does not have .NET 4.0 Framework installed
svInstallFailMsg = szFrameworkMissing;
endif;
endif;
if svInstallFailMsg != "" then
MessageBox( svInstallFailMsg, SEVERE );
abort;
endif;
endif;


http://helpnet.flexerasoftware.com/installshield18helplib/mergedProjects/installshield18langref/LangrefFeatureIsItemSelected.htm

HTH
0 Kudos
rogereeno
Level 3

Thank you. It turns out I was specifying the feature name incorrectly. The FeatureIsItemSelected does correctly indicate whether or not a feature is "checked" or "unchecked" in the SdFeatureTree dialog.

Regards,

- Roger
0 Kudos