2017-08-16 122 views
0

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

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

谢谢!

回答

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

+0

这正是我一直在寻找。我想我以前只是误解了文档。谢谢! –

+1

这是我的错误。我检查了这篇文章,我认为我没有选择它是正确的,所以我再次点击它。我从那以后纠正了这个错误。希望一切顺利,再次感谢您的帮助! –

相关问题