cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tim_Mayert
Level 9

VBScript to check for the existance of a Property

I am having to create a new dialog box in my basic MSI project that will allow the user to select 10 gallery content topics to install. What I then have to do is find out which ones were selected and then pass all these properties to a custom action that will call the tool that will extract and install all the selected gallery topics.

So the properties will either exist and = 1 or not exist.

What I would like to do is create a simple little VBScript that will simple check it each property exists and if so append the property name to a string. Once all the properties are checked then I would like to set a property to equal to this string. Then I could use the property as a command line entry for the custom action to use to all the gallery installer tool.

Since it has been a long time since I have had to create a VBScript custom action could someone just show me a quick script that will get the value or existance of a couple properties, create a string variable to contain that will add command line strings to it and then set the property so the msi installer can read it. It does not have to be a big script just enough to get me started.

Thanks,
Labels (1)
0 Kudos
(3) Replies
mikegillow
Level 5

When will your CA run? If it has to run in deferred mode, the property value won't be available and you will have to use CustomActionData instead, which is an entirely different animal to set up. Also, in my limited experience with it, a VBScript CA might not be a good choice - I found that my installer choked on the vbs CA when run on a Win2k Server even though it ran just fine on X and 2k3. I ended up having to have a C++ dll authored for me by another developer to get something that would run on all of the platforms I had to support.
0 Kudos
Tim_Mayert
Level 9

Well the custom action would be triggered in Immediate mode as it will be called right after the dialog box that gets the information from the users.

Thanks,
0 Kudos
mikegillow
Level 5


You will want to use Session.Property to read/write the values:

propertyout = ""
prop = Session.Property("SOMEPROPERTY")
If IsNull(prop) Or IsEmpty(prop) Then
' do stuff
Else
propertyout = propertyout+prop
' do other stuff
End If

.
.
.
Session.Property("PROPERTYOUT") = propertyout

You will need to add PROPERTYOUT to your property table (as well as your list that would replace SOMEPROPERTY).

Note - Bob Baker's book 'Practical Windows Installer Solutions' has a lot of example vbs and C++ CA sample code to draw from.
0 Kudos