AutoIT将已打开的IE窗口存储到对象中

时间:2017-08-16 18:27:17

标签: internet-explorer autoit

我正在尝试使用_Navigate命令来更改网页。问题是该窗口已经打开,我可以看到使用Navigate的唯一方法是使用Create自己创建窗口。

有没有办法以某种方式将已打开的IE窗口存储到对象中然后使用Navigate?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用_IEAttach功能。

来自docs ...

附加到搜索字符串子字符串匹配的Internet Explorer的指定实例(基于所选模式)

#include <IE.au3>
_IEAttach ( $sString [, $sMode = "title" [, $iInstance = 1]] )

<强>参数

$sString      String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window) 
$sMode        [optional] specifies search mode
                 "title" = (Default) sub-string of main document title
                 "windowtitle" = sub-string of full window title (instead of document title)
                 "url" = sub-string or url of the current page
                 "text" = sub-string in text from the body of the current page
                 "html" = sub-string in html from the body of the current page
                 "hwnd" = hwnd of the browser window
                 "embedded" = title sub-string or hwnd of the window embedding the control
                 "dialogbox" = title sub-string or hwnd of modal/modeless dialogbox
                 "instance" = $sString is ignored, one browser reference returned (by matching instance number) from all available browser instances 
$iInstance    [optional] 1-based index into group of browsers or embedded browsers matching $sString and $sMode. See Remarks.

返回值

Success:   an object variable pointing to the InternetExplorer Object for all but Embedded and DislogBox modes which return a Window Object. 
Failure:   sets the @error flag to non-zero. 
@error:    5 ($_IEStatus_InvalidValue) - Invalid Value
           7 ($_IEStatus_NoMatch) - No Match 
@extended: Contains invalid parameter number