check if process is running script
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2010
02:38 AM
07-02-2010
02:38 AM
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?
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2010
03:09 AM
07-02-2010
03:09 AM
Hi Ed
I think you might be looking for the WaitProcess method. This waits for a specified length of time to see if the specified process exists, without posting an error.
You can get full details on its use if you look up the topic in the on-line help.
Hope this helps.
Best regards
Stephen.
I think you might be looking for the WaitProcess method. This waits for a specified length of time to see if the specified process exists, without posting an error.
You can get full details on its use if you look up the topic in the on-line help.
Hope this helps.
Best regards
Stephen.
