I have problems using a custom action that checks if a certain process is running. In order to do that I use the following VB-Script (lp.vbs):
Function IsRunning()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'Foo.exe'")
If colProcesses.Count = 0 Then
IsSLRunning = False
Session.Property("FooRunning") = False
Else
IsSLRunning = True
Session.Property("FooRunning") = True
End If
End Function
This script is inserted as "UI Custom Action" with "Synchronous execution, ignore return code" and "Always Execute". Additionally I created a new Property "FooRunning" with Value "False" under "Install Parameters".
The purpose of this script is to show a certain dialogue (MyWarningDlg) if Foo.exe is running. I added new "Published Events" for the "Next" button of my Welcome-dialogue:
Event: DoAction
Argument: lp.vbs
Condition: AI_INSTALL
Event: NewDialog
Argument: FolderDlg
Condition: AI_INSTALL AND FooRunning = False
Event: NewDialog
Argument: MyWarningDlg
Condition: AI_INSTALL AND FooRunning = True
According to the Run Log my script is being executed without errors but neither the FolderDlg nor MyWarningDlg is shown. Is this the right way to set a user defined property by vbscript and to show dialogues according to its value?
many thxs in advance
FOLLOW US
Get the latest news in Application Packaging