NetNodeMan
Technical User
Hi all. I've tried a search on this and though lots of threads appear, none seem to specifically deal with this request:
I run a batch file called test. This batch files checks an internet page and enters data into the page. If all goes well it writes an "OK" message to a log file. If all goes wrong it provides a popup. This popup does not time out and must be clicked before the program can continue.
What I would like is that if an error occurs, the popup appears but for only 10 minutes. I have tried timing out the popup but this exits my batch file and I have to restart the batch file manually. I do not want to do this. Can anyone help?
I run a batch file called test. This batch files checks an internet page and enters data into the page. If all goes well it writes an "OK" message to a log file. If all goes wrong it provides a popup. This popup does not time out and must be clicked before the program can continue.
What I would like is that if an error occurs, the popup appears but for only 10 minutes. I have tried timing out the popup but this exits my batch file and I have to restart the batch file manually. I do not want to do this. Can anyone help?
Option explicit
Dim IE, sLoop, sLoop2, isOperationComplete, dState, sList, sError
Sub objIE_NavigateError(pDisp,URL,TargetFrameName,StatusCode,Cancel)
wscript.echo now() & " Error " & StatusCode & " accessing " & URL
End Sub
Sub objIE_NavigateError(pDisp,URL,TargetFrameName,StatusCode,Cancel)
wscript.echo now() & " Error " & StatusCode & " accessing " & URL
ieErr=true
End Sub
Function Wait()
sError = 1
Do while IE.busy
wscript.sleep 1000
sError = sError + 1
Loop
if sError > 20 then
exit Function
end if
dState = IE.document.readystate
while (dState <> "complete" and sError < 20)
Wscript.sleep 1000
dState = IE.document.readystate
sError = sError + 1
wend
if ieErr then 'navigation error
logfile.writeline now() & " Document failed to load. Please Investigate."
wshshell.popup "Document failed to load. Please Investigate",15 (popup appears but after timeout the batch file closes and I must restart manually - don't want that)
end if
end function
dim wshshell, fso, logfile, slog
dim ieErr : ieErr=false 'global scope added 20/07/05
slog="c:\log\logfilename.txt" 'your input
set wshshell=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
sLoop = "forever"
dState = ""
Do while sLoop = "forever"
sLoop2 = "forever"
Do while sLoop2 = "forever"
set logfile=fso.opentextfile(slog,8,true)
'************ HTTPS Check
set IE=Wscript.CreateObject("InternetExplorer.Application","objIE_")
IE.Navigate(" IE.visible = True
wait()
'Added by Finner, 8 Jul 2005. Populates the correct fields.
IE.document.getElementByID("VRM").value = "LD02YXZ" 'this is the VRM field
'IE.document.getElementByID("V5RefNo").value = "1" 'this is the V5 field
IE.document.getElementByID("TestNumber").value = "152008305118" 'this is the Test Number field
IE.document.getElementByID("cmdSubmit").click
wait()
if sError <= 20 then
wscript.echo now() & " Test OK"
logfile.writeline now() & " Test OK"
logfile.close
ie.quit
exit do
else
wscript.echo now() & " Test FAILURE"
logfile.writeline now() & " Test FAILURE"
wshshell.run "c:\ringin.bat"
wshshell.popup " Web Check has Failed. Please Investigate" (Also want the popup to timeout here and continue testing the application)
logfile.close
ie.quit
exit do
end if
'************ End of HTTPS Check
sLoop2 = "done"
Loop
'Wait for 5 Minutes
Wscript.Sleep 18000
Loop