为什么InternetExplorer对象无响应? [英] Why does InternetExplorer Object become unresponsive?

查看:259
本文介绍了为什么InternetExplorer对象无响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试登录到受密码保护的站点.我在VBScript中使用InternetExplorer对象.错误出现在一次读取oIE.readystate值之后-也就是说,在我的循环中,它一次读取了oIE.readystate值,但是在第二次尝试读取oIE.readystate值时,我得到了"800A01CE"运行时错误,指出远程服务器计算机不存在或不可用:'oIE.readystate'"

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'"

此代码在IE6中运行良好;我的公司暗含了新的广告政策(完全不知道这将如何/是否会影响此政策),我们现在正在使用IE7.我不确定IE7是否在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 oIe=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.

推荐答案

可能是对MsgBox的调用使它受挫.进行MsgBox会将焦点从IE更改为脚本解释器,这可能会使IE偏执其被劫持或其他原因.将它们更改为

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

并使用cscript myscript.vbs从命令行运行它.

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

这篇关于为什么InternetExplorer对象无响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆