autoit3 ie.au3 函数之——_IEAttach

来源:互联网 发布:淘宝能申请信用卡吗 编辑:程序博客网 时间:2024/06/08 11:19

_IEAttach: Attach to the specified instance of Internet Explorer where the search string sub-string matches (based on the selected mode).

即: 查找第一个存在的符合查找字串子串的IE例子,查找方式基于选择的模式

#include <IE.au3>
_IEAttach ( $s_string [, $s_mode = "Title" [, $i_instance = 1]] )

Parameters

$s_stringString to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window)$s_mode[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 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[optional] 1-based index into group of browsers or embedded browsers matching $s_string and $s_mode. See Remarks.

例子: 首先开打一个网页,可以在后台运行,其title 包含"百度一下", 然后显示其URL

; *******************************************************
; Example 1 - Attach to a browser with "AutoIt" in its title, display the URL
; *******************************************************
;

#include <IE.au3>
$bai_du = _IECreate("www.baidu.com")
Sleep(500)
$oIE = _IEAttach ("百度一下")
MsgBox(0, "The URL", _IEPropertyGet ($oIE, "locationurl"))


例子:当一个页面打开时, 可以根据其页面text来查找

; *******************************************************
; Example 2 - Attach to a browser with "手机数码"
;               in the text of it's top-level document
; *******************************************************
;
#include <IE.au3>
$360_buy = _IECreate("www.360buy.com")
Sleep(500)
$oIE = _IEAttach ("手机数码", "text")

MsgBox(0, "The URL", _IEPropertyGet ($oIE, "locationurl"))

原创粉丝点击