mstaton
Posts: 17
Joined: Wed Apr 22, 2009 2:24 pm

Features Selected, vbs

I'm a vbs dummy. I would like to use the features selected by the user to control what they see in the next dialog after the custom dialog (the tree view). Can I access which features they have selected this way? For example, I would have thought the two simple lines below would use the value of the feature to set a property for me but it just fails. I am calling this through an attached custom action where source path is test.vbs, which has the vbs code.

Code: Select all

s = Session.FeatureRequestState("MY_FEATURE")
Session.Property("MY_PROPERTY") = s
These lines will work, so I know it is at least correctly calling the script

Code: Select all

s = "hello"
Session.Property("MY_PROPERTY") = s
Whether vbs or some other way, what is the best way to access which features have been selected so that I can set a property, so that I can conditionally run some other custom actions, depending on what they have selected?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Features Selected, vbs

Hi,
I would like to use the features selected by the user to control what they see in the next dialog after the custom dialog (the tree view). Can I access which features they have selected this way?
Unfortunately this is not supported by Windows Installer for the feature selection tree. The feature actions (what the installer will do with the features) are set later in the install process.

However, you can try creating a custom feature selection dialog with checkboxes. The User Guide contains the Show a custom feature selection dialog how-to which may help you. This way you can use the properties of the checkboxes to control the next dialog.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mstaton
Posts: 17
Joined: Wed Apr 22, 2009 2:24 pm

Re: Features Selected, vbs

The tree view was very important to me. I understand you to be saying there is no way to know what was selected and de-selected from the tree view. Is that correct?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Features Selected, vbs

Hi,
I understand you to be saying there is no way to know what was selected and de-selected from the tree view. Is that correct?
After some further testing I managed to use this script:

Code: Select all

Dim state
state = Session.FeatureRequestState("MainFeature")
MsgBox state
Although it's not completely accurate (it shows INSTALLSTATE_UNKNOWN instead of INSTALLSTATE_ABSENT), it shows the feature action for the feature with the identifier "MainFeature". You can try adapting it for your project. The .VBS file can be added as an Attached UI custom action and you can launch it on the "Next" button of the "CustomizeDlg" dialog.

Please note that the identifier of a feature is set in its "Feature Properties" pane in the "Organization" page.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mstaton
Posts: 17
Joined: Wed Apr 22, 2009 2:24 pm

Re: Features Selected, vbs

Awesome. Thank you for that.

Working out from your answer, I realized that one of my problems is that I need to use CStr() to set a property to the value of a variable. Like I said, a vbs dummy.

I can also do the following in an inline script. So whether the external .vbs file or inline script is better, I am covered.

Code: Select all

Session.Property("MY_PROPERTY") = CStr(Session.FeatureRequestState("MY_FEATURE"))
Thanks for your help - much appreciated.

Return to “Common Problems”