ie操作
pwb := ComObjCreate("InternetExplorer.Application") ;创建一个InternetExplorer.Application对象
pwb.Visible := 1 ;设置未可见,若为0则虽未可见,但在进程管理器里可以观察到创建了iexplore.exe的进程
pwb.Navigate("https://passport.baidu.com/?login&tpl=mn") ;加载网页https://passport.baidu.com/?login&tpl=mn
while pwb.ReadyState <> 4 or pwb.busy ;等待网页加载完毕
{}
sleep,10
;~ 例子:
;~ IE选项卡里打开www.baidu.com,在搜索栏里输入test,以下代码成功获取test字符
ComObjError(false) ;关闭对象错误提示
ie:=IEGetFromUrl("https://www.baidu.com") ;获取包含https://www.baidu.com网页的一个选项卡对象ie
text:=ie.document.getElementById("kw").value ;通过ie.doucument对当前网页进行操作
MsgBox %text%
;获取包含指定url的IE选项卡对象,从而成功操作对应的doucment对象
IEGetFromUrl(url){
for window in ComObjCreate("Shell.Application").Windows
{
if InStr(window.document.url,url) && InStr( window.FullName, "iexplore.exe" )
return window
}
}
;获取包含指定标题的IE选项卡对象
IEGetFromTabName(IETabName)
{
For window in ComObjCreate( "Shell.Application" ).Windows
{
if ( window.LocationName = IETabName ) && InStr( window.FullName, "iexplore.exe" )
return window
}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

