Hi All,
Please help! I scheduled a task to run every night by executing a VBScript file. The purpose is to post to the url or servlet to create the html file. The VBScript opens browser, invokes url, wait while html file is creating, and close the browser. The test ran fine when the computer is not locked (CTRL+ALT+DEL,W). If the computer is locked, the VBScript seems NOT to executes. I log every single line of executed code. It’s executed every line of code but it’s not open the browser go to the url. Attached is a snipped code, please help.
Dim WshShell, generateURL, siteURL
generateURL = “http://localhost:8080/job/generateColor.html”
siteURL = “http://localhost:8080/test/index.html”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
‘OPEN BROWSER
WshShell.Run “IEXPLORE”
‘sleep time (no action)
WScript.Sleep(100)
‘no address in the address bar
WshShell.AppActivate “about:blank”
WScript.Sleep(100)
‘ OPEN THE HTML FILE THROUGH BROWSER
‘Enter the URL in the address bar
‘open address bar – CTRL+O or ALT+F+O
WshShell.SendKeys(“^o”)
‘enter the url
WshShell.SendKeys(generateURL)
‘enter or return key
WshShell.SendKeys(“~”)
‘ SLEEP, NO ACTION
‘Allow browser time to load html
WScript.Sleep(5000)
WshShell.AppActivate “focus”
‘ OPEN THE HTML FILE THROUGH BROWSER
‘Enter the url in the address bar
WshShell.SendKeys(“^o”)
WshShell.SendKeys(siteURL)
WshShell.SendKeys(“~”)
‘SLEEP, NO ACTION
‘Allow browser time to load html
WScript.Sleep(5000)
WshShell.AppActivate “EFB”
‘CLOSE BROWSER
‘Close browser ALT+F4
WshShell.SendKeys(“%{F4}”)
Set WshShell = Nothing