dseaver
IS-IT--Management
- Jul 13, 2006
- 467
I need to check to make sure a process is running and count how much time has gone by since the checker has been looking for the process. Windows complains about the for loop in this sub, can anybody see what is wrong, and also, please suggest a better way to do the following if you know of one
Code:
Sub CheckForRestore
Dim i
Dim counter
i = 0
counter = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in colProcess
if objProcess.Name = "TrueImageCmd.exe" Then
i = 1
end if
Do While i = 1
colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in colProcess
if objProcess.Name = "TrueImageCmd.exe" Then
i = 1
end if
Next
if i = 0 Then
Call Cancel_onclick()
end if
window.setTimeout(null, 1000, "VBScript")
counter = counter + 1
Loop
End Sub