2017-08-16 60 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

這是我的錯誤。我檢查了這篇文章,我認爲我沒有選擇它是正確的,所以我再次點擊它。我從那以後糾正了這個錯誤。希望一切順利,再次感謝您的幫助! –

相關問題