mmp
Posts: 4
Joined: Fri Nov 06, 2009 12:23 am

Passing Value from vbscript to parameter in MSI

I can pass a value to a vbscript with no problem but I just don't get it how you pass a value from the vbscript back to a parameter in the MSI.

I do not use "C" or C++ so please be specific on what steps I need to follow.

What kind of parameter do I need to create and which fields need filled in. An example or a screen shot of the fields filled in would work wounders.

Thank You Very Much.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Passing Value from vbscript to parameter in MSI

Hi,

Just as you use code like:

Code: Select all

somevariable = Session.Property("PROPERTY_NAME")
you can use:

Code: Select all

Session.Property("PROPERTY_NAME") = someothervariable
inside your vbscript. This would assign the value of someothervariable to the PROPERTY_NAME property.
Note that someothervariable must be of string type if it is not already so. To that extent you can use something like:

Code: Select all

Session.Property("PROPERTY_NAME") = CStr(someothervariable)
to convert it to string type.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
mmp
Posts: 4
Joined: Fri Nov 06, 2009 12:23 am

Re: Passing Value from vbscript to parameter in MSI

Thank you for your responce.

I am simply not grasping it. I looked up assigning variables and PROPERTY_NAME and it looks like I need an environmental variable to store variable and I was confused on creating new Properties to receive a value.

I want to use a property to hold the value if possible.

1. What kind of Custom property do I use? "Property Source" , "Property set with formatted"
2. Where does the "Session.Property("PROPERTY_NAME") = someothervariable" go in the MSI "Property Source" or "Property set with formatted" to receive the value from the VBScript?
3. I assume the "PROPERTY_NAME" is replaced a with a property name like "VALUE_PASSED"?

mmp
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Passing Value from vbscript to parameter in MSI

Hello,
1. What kind of Custom property do I use? "Property Source" , "Property set with formatted"
2. Where does the "Session.Property("PROPERTY_NAME") = someothervariable" go in the MSI "Property Source" or "Property set with formatted" to receive the value from the VBScript?
Well, you do not need to use "Property Source" or "Property Set with Formatted". The code I mentioned above needs to be placed in the VBScript (.vbs) file itself. Note that the vbscript custom action must be set as an "Immediate execution".
3. I assume the "PROPERTY_NAME" is replaced a with a property name like "VALUE_PASSED"?
Indeed, replace PROPERTY_NAME with an appropriate name.

Also, note that properties are created upon assignation, which means the PROPERTY_NAME property will be created when it is assigned a value through:

Code: Select all

Session.Property("PROPERTY_NAME") = someothervariable
written in your vbscript file.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”