Hi,
The VBScript that will execute the helper application is presented below:
Code: Select all
Dim HelperPath, HelperApp
Dim pos, args, strCmd, ret
' Retrieve the path of the helper program
HelperApp = Session.Property("CustomActionData")
' MsgBox HelperApp
Set WshShell = CreateObject("WScript.Shell")
' Extract the path of the helper app
pos = InStrRev(HelperApp, "\", Len(HelperApp))
MsgBox Len(HelperApp) & " " & pos
HelperPath = Left(HelperApp, pos)
' MsgBox HelperPath
' Set the current directory
WshShell.CurrentDirectory = HelperPath
' The arguments that are passed to the helper program
args = "file1.ini" & " " & "file2.dll"
' Invoke the program: we must use quotes arround the whole command
strCmd = chr(34) & HelperApp & chr(34) & " " & args
' MsgBox strCmd
' Run the command
ret = WshShell.Run(strCmd, 1, true)
' MsgBox ret
' Check the return code
If ret <> 0 Then
MsgBox "Error !"
Quit ret
End If
' TODO: delete the helper app and related files
This script retrieves the path of the helper application, sets the current directory with this path and then executes the helper program with 2 command line arguments (2 files that must exist in the same folder as itself).
The return code is checked and an error is displayed if necessary. Note that you can not stop the MSI failure message from appearing. However, this message can be changed by modifying the appropriate dictionary files.
You should also add code that deletes the helper program an the related files.
These are the steps you should follow:
1. In the Custom Actions page, make sure that the "InstallFiles" item appears in the tree control.
2. Add a "Property Set with Formatted" Custom Action after the "InstallFiles" stage. Set the Property Name to
"HelperPath", then use the "Edit" button at the right of the "Formatted Text" field to select the helper program from your package.
3. Add a "New Attached Custom Action" after the "InstallFiles" stage and select the file containing the above script.
- Make sure that the name of this Custom Action (the item name in the tree control) is set to
"HelperPath" (the name of the property set by the above Custom Action).
- Make sure that the Function Name field is empty.
- Set the Execution Option to "Deferred".
4. For both of the above Custom Actions, set the Execution Condition to: (Not Installed).
5. The program that performs the removal of your driver components can be added as an Attached Custom Action with the Execution Condition set to: REMOVE = "ALL"
Regards,
Denis