PDA

View Full Version : Pass arguments from InstallShield to VBS



xtinction84
06-14-2010, 11:27 AM
Dear All,

I have a VBScript program that should be called from Custom Action. And I
failed to find a way to pass some parameters to it.

I have this custom action in Deferred Execution in system context:

Filename&Command Line:." "[INSTALLDIR]MyFolderVazio\RunVBS.vbs" "[INSTALLDIR]" "

I have this vbs:
Set args = WScript.Arguments
arg1 = args.Item(0)
MsgBox ""+arg1+ " "


Help please.
Thanks

Ajay Ladsaria
06-30-2010, 11:57 AM
What is currently displayed by your message box currently? I assume that you are able to at least display something hard-coded such as "Hello world" successfully?

I think you should be able to pass [INSTALLDIR] on the command line to your vbscript script that you are installing with your product.

hidenori
06-30-2010, 12:56 PM
Since you are using a deferred custom action, you need to use the CustomActionData property to access the INSTALLDIR property. Please refer to Accessing or Setting Windows Installer Properties Through Deferred, Commit, and Rollback Custom Actions (http://helpnet.flexerasoftware.com/Robo/BIN/Robo.dll?tpc=/robo/projects/installshield16helplib/AccessingProps-DeferredCAs.htm) help topic for more information. There is also a sample VBScript code (http://community.flexerasoftware.com/showthread.php?t=120824)to access the CustomActionData property in this community forum.

destek
07-22-2010, 06:25 PM
Also - as I recall you cannot access the WScript methods directly in any CA, though you can create object methods.

So

Set WshShell=CreateObject("WScript.Shell")

Is perfectly OK, however

Set args = WScript.Arguments

is not valid in a CA. Unfortunately that means you simply cannot use it.

Another way to do this might be to set a session property to the value you want to use inside the vb script then access it through

Arg = Session.Property("YourSessionPropertyName")

You will need two custom actions - one that sets the session property you want to pass in, and then the custom action with the vbscript.