开发者

Why does InternetExplorer Object become unresponsive?

开发者 https://www.devze.com 2023-01-03 07:51 出处:网络
I am attempting to login to a password protected site. I\'m using the InternetExplorer Object in VBScript. Error lies after oIE.readystate value is read one time - that is, in my loop, it reads the oI

I am attempting to login to a password protected site. I'm using the InternetExplorer Object in VBScript. Error lies after oIE.readystate value is read one time - that is, in my loop, it reads the oIE.readystate value one time, but upon the second time oIE.readystate value is attempting to be read, I get a "800A01CE" runtime error, stating "The remote server machine does not exist or is unavailable:'oIE.readystate'"

This code worked fine in IE6; my company implimented new AD policy (not sure how/if that affects this at all) and we are now using IE7. Im not sure if IE7 is somehow blocking the process after oIE.readystate. Any suggestions are greatly appreciated.

Notation: "-->" indicates that I am writing commentary about the output of the process directly after that particular line of code executes.

set 开发者_如何学JAVAoIe=wscript.createobject("InternetExplorer.Application", "IE_")
oIe.navigate "www.google.com"

do while oIe.readystate<>4
   msgbox "oIE readystate: " & oIE.readystate
   ''#-->gets here one time and outputs "oIE readstate: 0"
   wscript.sleep 1000
   msgbox "oIE readystate: " & oIE.readystate
   ''#-->errors out.
loop

msgbox "outside of oIE readystate: " & oIE.readystate
''#--->never gets here.


It might be the call to MsgBox that's fouling it up. Doing a MsgBox changes the focus from IE to the script interpreter, which might make IE paranoid that it's being hijacked or something. Change them to

WScript.Echo "oIE readystate: " & oIE.ReadyState

And run it from the command line using cscript myscript.vbs instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消