mfairbrother
Posts: 29
Joined: Tue Dec 20, 2005 12:39 pm

Custom Action Properties, viewer.exe, vbs, passing args?

Is it possible to pass arguments to a vbs script, when using viewer.exe?



Goal: I want to run several custom actions without generating windows.

Currently trying to use viewer.exe, with a source type of vbs, it's not clear to me how to use the Function Name field.

Here's what I am trying:
setProperties.vbs /Server:[SERVER_ADDRESS] /AgentPort:[AGENT_PORT] /NotifyPort:[NOTIFY_PORT] /FetchPort:[FETCH_PORT] /PollingInterval:[POLLING_INTERVAL] /PollingOnly:[POLLING_ONLY]


Here's the resulting error log:

MSI (s) (D4:04) [06:31:49:655]: Executing op: ActionStart(Name=desktopProperties,,)
MSI (s) (D4:04) [06:31:50:562]: Executing op: CustomActionSchedule(Action=desktopProperties,ActionType=1030,Source=MZ
mfairbrother
Posts: 29
Joined: Tue Dec 20, 2005 12:39 pm

Also tried using viewer.exe, with source type set to exe

With the following command line:

[SystemFolder]cscript.exe //B //nologo "[!setProperties.vbs]" /Server:[SERVER_ADDRESS] /AgentPort:[AGENT_PORT] /NotifyPort:[NOTIFY_PORT] /FetchPort:[FETCH_PORT] /PollingInterval:[POLLING_INTERVAL] /PollingOnly:[POLLING_ONLY]

from the log

MSI (s) (D4:EC) [07:27:27:845]: Executing op: ActionStart(Name=desktopProperties,,)
MSI (s) (D4:EC) [07:27:27:892]: Executing op: CustomActionSchedule(Action=desktopProperties,ActionType=1026,Source=BinaryData,Target=C:\WINDOWS\system32\cscript.exe //B //nologo "C:\Program Files\Agent\setProperties.vbs" /Server:NULL /AgentPort:9998 /NotifyPort:9997 /FetchPort:9996 /PollingInterval:300 /PollingOnly:false,)

The resulting file that setProperties.vbs creates doesn't exist, so it doesn't appear to work either.
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

You should use "WScript" instead of "CScript", because the former generates windowed output, while the latter sends its output to a command window. Additionally, you must use a "Property Source" Custom Action instead of "Launch File or Open URL".

These are the steps you should follow:

1. In the Search page, use the New File Search toolbar button and name this search WSCRIPT. In the Name field enter "wscript.exe" (without quotes).

2. Right click the WSCRIPT item and select "Add Location -> Folder". In the Path field enter [SystemFolder] and in the Depth field enter 0. This will cause the WSCRIPT property to be set to the full path of "wscript.exe".

3. In the Custom Actions page right click the Install item and select "New Custom Action -> Property Source". Enter WSCRIPT in the Property Name field and set the Source Type to "Executable".

4. In the Command Line field enter:

Code: Select all

"[#setProperties.vbs]" /Server:[SERVER_ADDRESS] /AgentPort:[AGENT_PORT] /NotifyPort:[NOTIFY_PORT] /FetchPort:[FETCH_PORT] /PollingInterval:[POLLING_INTERVAL] /PollingOnly:[POLLING_ONLY] 
The quotes are necessary because the path may contain spaces (such as "Program Files"). Also, use "#" instead of "!" to add a reference to a file included in the package.

5. Set "Deferred" as the Execution Option.

6. If necessary, set the Execution Condition to an appropriate value. For example you may want this Custom Action not to execute on Uninstall.

Hope this helps.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
mfairbrother
Posts: 29
Joined: Tue Dec 20, 2005 12:39 pm

Thank you that was very helpful.

Return to “Common Problems”