AutoIT 将一个已经打开的 IE window 存储到一个对象中

AutoIT store an already open IE window into an object

我正在尝试使用 _Navigate 命令更改网页。问题是 window 已经打开,我可以看到使用 Navigate 的唯一方法是使用 Create.

自己创建 window

有没有办法以某种方式将已打开的 IE window 存储到一个对象中,然后在该对象上使用 Navigate?

谢谢!

您可以使用_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.

Return 值

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