i have fallen victim to the following error SWbemObectEx:-2147217406. I am not sure if it can be replicated but i get it quiet often when i run some of my scripts. I have attached a copy of a simplified script that also gives this error.
Code: Select all
VBSTART
Sub killProcess(pgm)
set wmi = getobject("winmgmts:")
sQuery = "select * from win32_process " & "where name='" & pgm & "'"
set processes = wmi.execquery(sQuery)
for each process in processes
process.terminate
next
End Sub
VBEND
//EventTimer part of the script
Let>timerFlag=0
Let>TimePeriod=20
Timer>StartTime
OnEvent>Custom,EventTimer,TimedOut,ResultEvent
SRT>EventTimer
Timer>EndTime
Let>TotalTime={(%EndTime%-%StartTime%)/1000}
If>%TotalTime%>%TimePeriod%
Let>TimedOut=True
EndIf
END>EventTimer
SRT>ResultEvent
//Start process that will wait for this script to exit
//then restart this script
//Do any closing processes needed before exit
ProcessExists>iexplore.exe,iexploreExists
If>iexploreExists=True
VBRun>Killprocess,iexplore.exe
WaitProcessTerminated>iexplore.exe
wait>2
Message>process not completed
wait>5
Endif
Exit>0
END>ResultEvent
//Stuff in your current script
//RunProgram>C:\Windows\notepad.exe
IECreate>0,IE[0]
WindowAction>1,Internet Explorer*
IENavigate>%IE[0]%,http://help.mjtnet.com/,ie_res
IEWaitDocumentComplete>%IE[0]%,ie_res
IEWait>IE[0]
wait>2
IEWaitDocumentComplete>%IE[0]%,ie_res
IEWait>IE[0]
wait>2
Timer>StartTime
wait>1
Timer>StartTime
//Stuff in your current script
GetTextInit
GetWindowTextEx>Macro Scheduler Knowledge Base - Internet Explorer,result
WaitScreenText>Macro Scheduler is the best
wait>2
Timer>StartTime
//Stuff in your current script
Message>process completed!! :)
wait>5
Timer>StartTime
or maybe i am doing something wrong.
please share. thank you