hmxchooch
Posts: 24
Joined: Tue Apr 07, 2009 6:55 pm

Conditional File Install Issue

Hi,

I have followed this guide on how to create a conditional install for files:
http://www.advancedinstaller.com/forums ... 39&start=0

However, I'm having a problem. On one of my first screens I give a radio dialog that allows the user to choose a region: NorthAmerica or Europe. Depending on their choice, I would like to install a few different files.

I followed the above guide exactly, but it is basing it's conditional installs on the windows version. I would like to base my feature on a dialog choice. In looking for an answer I came across this statement:
"You cannot condition the installation of a feature by using a property set in the User Interface of the installation." - http://www.advancedinstaller.com/user-g ... ialog.html

Is what I'm trying to do impossible? Or am I just going about it the wrong way.

Thank you!
- Chris
hmxchooch
Posts: 24
Joined: Tue Apr 07, 2009 6:55 pm

Re: Conditional File Install Issue

Hi,

I also tried the tutorial here for radio buttons: http://www.advancedinstaller.com/user-g ... ature.html

This is my script that is called when the "Next" button of my RegionSelectDialog, but it seems to *always* install European files...

Code: Select all

' Set contants for the INSTALLSTATE_ABSENT and INSTALLSTATE_LOCAL feature states
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal  = 3

' Initialize the install states of the mutually exclusive features 
' and set their states based on the radio button selection
Session.FeatureRequestState("EuropeFiles") = msiInstallStateAbsent
Session.FeatureRequestState("NorthAmericaFiles") = msiInstallStateAbsent

If Session.Property("RegionSelect") = "NorthAmerica" Then
  Session.FeatureRequestState("NorthAmericaFiles") = msiInstallStateLocal
ElseIf Session.Property("RegionSelect") = "Europe" Then
  Session.FeatureRequestState("EuropeFiles") = msiInstallStateLocal
End If
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Conditional File Install Issue

Hi Chris,

Please note that in order to be able to pass the value of a property from the user interface you should use public properties.
All public properties must be written with upper cases, otherwise you will not be able the pass their values.

In your case you it is not correct to use "EuropeFiles" and "NorthAmericaFiles", instead you could use something like this: "EUROPE_FILES" and "NORTH_AMERICA_FILES".

Please let me know if the problem persists.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
hmxchooch
Posts: 24
Joined: Tue Apr 07, 2009 6:55 pm

Re: Conditional File Install Issue

Hrm? NorthAmericaFiles and EuropeFiles are *Features*, not properties.

I did however change RegionSelect to be REGIONSELECT as I do need that to be a global property. And, just in case I misread (or you mistyped) I changed EuropeFiles to EUROPE_FILES and NorthAmericaFiles to NORTH_AMERICA_FILES. However, I'm still running into this issue.

I have modified my VBS script appropriately:

Code: Select all

' Set contants for the INSTALLSTATE_ABSENT and INSTALLSTATE_LOCAL feature states
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal  = 3

' Initialize the install states of the mutually exclusive features 
' and set their states based on the radio button selection
Session.FeatureRequestState("EUROPE_FILES") = msiInstallStateAbsent
Session.FeatureRequestState("NORTH_AMERICA_FILES") = msiInstallStateAbsent

If Session.Property("REGIONSELECT") ="NorthAmerica" Then
  Session.FeatureRequestState("NORTH_AMERICA_FILES") = msiInstallStateLocal
ElseIf Session.Property("REGIONSELECT") = "Europe" Then
  Session.FeatureRequestState("EUROPE_FILES") = msiInstallStateLocal
End If
This is my log output from running this custom action:

Code: Select all

MSI (c) (10:28) [10:59:49:217]: Doing action: custom_action_features.vbs
Action 10:59:49: custom_action_features.vbs. 
Action start 10:59:49: custom_action_features.vbs.
MSI (c) (10!28) [10:59:49:529]: Note: 1: 2727 2:  
MSI (c) (10!28) [10:59:49:576]: Note: 1: 2727 2:  
MSI (c) (10!28) [10:59:49:623]: Note: 1: 2727 2:  
Action ended 10:59:49: custom_action_features.vbs. Return value 0.
However, despite the custom action defaulting both features to 'Absent' it tries to install them both (another excerpt from the log):
Property(S): ADDLOCAL = NORTH_AMERICA_FILES,MainFeature,EUROPE_FILES

Something doesn't seem right...

I have also tried to use the "Conditional install level" on the Features but I can't get that to correctly check REGIONSELECT either. These two methods are mutually exclusive, right? I shouldn't be trying to do both at the same time I presume...

Thanks for your help, I look forward to your response.
hmxchooch
Posts: 24
Joined: Tue Apr 07, 2009 6:55 pm

Re: Conditional File Install Issue

I did some more reading through old forum threads, and discovered that "Conditional install level" is evaluated before any dialogs are shown, so I guess I can't use that.

Which leaves me with my .vbs that I posted above, which does not appear to work at all. I even culled the script down to just this, to see if it would stop any files from those features from being installed:

Code: Select all

' Set contants for the INSTALLSTATE_ABSENT and INSTALLSTATE_LOCAL feature states
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal  = 3

' Initialize the install states of the mutually exclusive features and set their states based on the radio button selection
Session.FeatureRequestState("NORTH_AMERICA_FILES") = msiInstallStateAbsent
Session.FeatureRequestState("EUROPE_FILES") = msiInstallStateAbsent
Even with this script being executed, BOTH NA and EU files were installed again (with EU overwriting NA as I mentioned earlier). It doesn't appear that the script has any affect whatsoever on my feature selection.

It actually seems like I'm having an identical problem to this poster:
http://www.advancedinstaller.com/forums ... ate#p19689
hmxchooch
Posts: 24
Joined: Tue Apr 07, 2009 6:55 pm

Re: Conditional File Install Issue

Sorry for all the posts!

I think I solved this. My install level was set in a dialog box to 3, which was resetting anything that happened in previous dialogs. I removed that, and this seems to be working now.

Return to “Common Problems”