edrider
14 years agoNew Contributor
check if process is running script
Hello, I have a problem with the following vb script.
If (Sys.Process("x").Exists) Then
do A
ElseIf (Not Sys.Process("x").Exists) Then
do B
Else
do C
End If
When I run this script when process x is NOT running, it "does B" successfully, but still outputs 2 errors into the log saying that it could not find process x when executing the first if statement, and that it could not find x when executing the elseif either.
I do not want to see any errors.
I want to perform the action "do A" if the process is running, and "do B" if the process is not running.
What am I doing wrong?
If (Sys.Process("x").Exists) Then
do A
ElseIf (Not Sys.Process("x").Exists) Then
do B
Else
do C
End If
When I run this script when process x is NOT running, it "does B" successfully, but still outputs 2 errors into the log saying that it could not find process x when executing the first if statement, and that it could not find x when executing the elseif either.
I do not want to see any errors.
I want to perform the action "do A" if the process is running, and "do B" if the process is not running.
What am I doing wrong?