Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedded Loop problem

Status
Not open for further replies.

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
 
I fixed the for loop, but now I am getting an "Expected Statement" Error on the End Sub line, which I know is above that line
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top