cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
xtinction84
Level 3

Pass arguments from InstallShield to VBS

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
Labels (1)
0 Kudos
(3) Replies
Ajay_Ladsaria
Level 7

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.
0 Kudos
hidenori
Level 17

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 help topic for more information. There is also a sample VBScript code to access the CustomActionData property in this community forum.
0 Kudos
Videstra
Level 7

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.
0 Kudos