View Full Version : Need help with a script

Roddy Trull
01-09-2003, 10:38 AM
In our installation we have two features (A & B), only one of which is installed. The location of the user determines which of the two to install; something like: if the location is City1 or City2, install A, otherwise install B. Currently, we use the Setup Types to get this info. During installation, the user selects one of two Setup Type radio buttons. This is not the best solution for us.

By nosing around I found a registry value that has the location as its data, now I need help in how I can use it. In HKEY_CURRENT_USER is the key Volatile Environment; within this is the value MY_SITE. The data in MY_SITE is the location that I need.

I set up a Software Requirement through the System Search Wizard, but I don't think I can use it as a condition on the feature because the test would be on the existence of MY_SITE, whereas I need the data in MY_SITE.

I did find that the property created as a result of this Software Requirement (MY_SITE) is set to the location. This is where I need help. I should think that a Visual Basic custom action could be written to do this. Simply enough, what I need is a script that does this:

IF MY_SITE == city1 or MY_SITE == city2
install feature A
install feature B

My Visual Basic knowledge is very limited, so any help is appreciated.

01-09-2003, 11:49 AM
Actually insead of reverting to Visual Basic we should be able to still do this with the search feature. The trick would be to use an ini file so that it will show up as a default search in the "Requirements" view. This approach might still be a little problematic. Try the following:

1. Create a new project
2. Add the MY_SITE search as you have already done
3. Add two root level feature and leave the default names and two files to them
4. Go to Setup Types view and DESELECT these two features from all three setup types (this makes the two features not install at all)
5. Now run the following VBSript as a Custom Action after Setup Types or Ready to Install dialog:

Dim RegValue
RegValue = Session.property("MY_SITE")
If (RegValue="city1") Or (RegValue="city2") Then
End if

If this works we can apply it to your project. Only thing we have to use the internal feature names in the VBScript. If you have ORCA I can tell you how to find it. If not send me you ise file and I'll tell you what they are.