jfuhr
Posts: 41
Joined: Wed Mar 19, 2008 4:52 pm

How do I pass parameters to VBScript?

I need to update a configuration file that is installed and the only way I can see doing that is by using a VBScript.

I need to pass values to this but can't find a way to do that.

I've set up a Custom Action for an Attached File. Pointed to the .VBS file and set Function Name to my vbscript function, SetConfig.

I've tried adding my parameters in the Function Name, such as SetConfig("a", "b") and also tried putting the parameters in the Action Data. Both do not work.

Thanks!
jfuhr
Posts: 41
Joined: Wed Mar 19, 2008 4:52 pm

After searching the forum a bit, I found previous articles that say the only way to pass parameters is using the Property in AI.

I've gotten closer, but still can't pass in a parameter. As a simple test, here is what I did:

Test.vbs

Msgbox Session.Property("param1")


In Custom Action:

Created a Formatted Property
property name = param1
formatted text = 'testValue'

Created an Attached File
source path = ...Test.vbs
type = vbs
function name = (empty)
action data = (empty)

When it executes, the message box pops up, but without data.
gabriel
Posts: 15
Joined: Mon Mar 17, 2008 3:39 pm
Location: Craiova
Contact: Yahoo Messenger

Hi,

Please note the you should use a public property (all uppercase letters) instead of a private property. This is recommended because Windows Installer will not pass the value of a private property from the "InstallUISequence" (when the property is initialized) to the "InstallExecuteSequence" (when the property is used by a custom action).

You can read more about installer properties here:
http://www.advancedinstaller.com/user-g ... rties.html

Also, the default value of the property should be specified in the "Install Parameters" page (recommeded), by a "Property set with formatted" custom action or by a control event (for example a button).

I noticed that you did not mention the Execution Option used by a custom action. Note that in order to allow the custom action to access an installer property, you should set it as "Immediate".

If the problem persists after making the necessary modification, please send us the AIP to support at advancedinstaller dot com so we can investigate it.

Regards,
Ovidiu
_________________
Ovidiu Blejdea
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”