_IEAttach
Attach to the specified instance of Internet Explorer where the search string sub-string matches (based on the selected mode).
#include <IE.au3>
_IEAttach($s_string [, $s_mode = "Title" [, $i_instance = 1]])
Параметры
$s_string | String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window) |
$s_mode |
[необязательный] specifies search mode Title = (по умолчанию) 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 of the window embedding the control DialogBox = title sub-string or hwnd of modal/modeless dialogbox Instance = $s_string is ignored, one browser reference returned (by matching instance number) from all available browser instances |
$i_instance |
[необязательный] 1-based index into group of browsers or embedded browsers matching $s_string and $s_mode. See Remarks. |
Возвращаемое значение
Успех: | Возвращает an object variable pointing to the InternetExplorer Object for all but Embedded and DislogBox modes which return a Window Object |
Ошибка: | Возвращает 0 и устанавливает @error |
@error: | 0 ($_IEStatus_Success) = Нет ошибок |
5 ($_IEStatus_InvalidValue) = Неверное значение | |
7 ($_IEStatus_NoMatch) = Нет совпадений | |
@extended: | Содержит номер неверного параметра |
Примечания
_IEAttach provides the "dialogbox" parameter to attach to modal and modeless dialogs created by the browser. It is important to note that not all dialogs created through browser interaction can be attached to and controlled in this way. Many of these dialogs are actually standard windows and can be controlled through the traditional AutoIt window functions. A reliable way to tell the difference between these types of windows is to use the "AutoIt Window Info" tool to examine it -- if the window contains a control called "Internet Explorer_Server" then you can attach to it with this function, if it does not it is a standard window and traditional AutoIt windows functions must be used to control it.См. также
_IECreate, _IECreateEmbedded, _IEQuitПример
; *******************************************************
; Пример 1 - Attach to a browser with "AutoIt" in its title, display the URL
; *******************************************************
#include <IE.au3>
$oIE = _IEAttach ("AutoIt")
MsgBox(4096, "The URL", _IEPropertyGet ($oIE, "locationurl"))
; *******************************************************
; Пример 2 - Attach to a browser with "The quick brown fox"
; in the text of it's top-level document
; *******************************************************
#include <IE.au3>
$oIE = _IEAttach ("The quick brown fox", "text")
; *******************************************************
; Пример 3 - Attach to a browser control embedded in another window
; *******************************************************
#include <IE.au3>
$oIE = _IEAttach ("A Window Title", "embedded")
; *******************************************************
; Пример 4 - Attach to the 3rd browser control embedded in another window
; Use the advanced window title syntax to use the 2nd window
; with the string 'ICQ' in the title
; *******************************************************
#include <IE.au3>
$oIE = _IEAttach ("[REGEXPTITLE:ICQ; INSTANCE:2]", "embedded", 3)
; *******************************************************
; Пример 5 - Create an array of object references to all current browser instances
; The first array element will contain the number of instances found
; *******************************************************
#include <IE.au3>
Dim $aIE[1]
$aIE[0] = 0
$i = 1
While 1
$oIE = _IEAttach ("", "instance", $i)
If @error = $_IEStatus_NoMatch Then ExitLoop
ReDim $aIE[$i + 1]
$aIE[$i] = $oIE
$aIE[0] = $i
$i += 1
WEnd
MsgBox(4096, "Browsers Found", "Number of browser instances in the array: " & $aIE[0])