Hi,
However I don't know how to execute this script.
The code which hides the application window can be pasted into a .VBS file which can be added as an Attached custom action.
Is the "Function Name" field important and what should I type in there?
Yes, this field is important and it should contain the function in the VBScript you want to call. If you don't use any functions in your VBScript (like your custom action), the "Function Name" field should be empty. This way, the custom action will try to run the entire VBScript.
Let's say the .bat file, which is executed in the VB script is in a subfolder of the Application Folder, called "New Folder". What is the realtive path to the .bat file in this case?
Please note that the sample code doesn't specify the path of the target file. For a real custom action, you should specify the exact path of the file. Also, since the custom action runs as Deferred, it will not have access to installer properties.
However, if you want to use a file in the installation folder, you can try this approach:
- modify the .VBS file to look like this:
Code: Select all
const WindowStyleStealth = &H20000000
set WSO = createobject("WScript.Shell")
dim command
command = "%comspec% /c" & Session.Property("CustomActionData") & "New Folder\MyApp.exe"
WSO.run command, WindowStyleStealth, false
- add the .VBS file as an Attached custom action
- make sure it is set as "
Deferred" and that the "Function Name" field is empty
- in the "
Action Data" field add the
[APPDIR] property
When the installation runs, the value of the APPDIR property will be transfered into the "
CustomActionData" property. This way, the "
command" variable in the script will use this path:
[APPDIR]New Folder\MyApp.exe".
Regards,
Cosmin