点击网页中指定的链接时,触发ahk脚本执行,能否给个实例?

遇到了问题?请先进行搜索(中文和英文),然后在此提问
gongnl
Posts: 72
Joined: 05 Jan 2015, 03:57
Location: /gongnltmp/

点击网页中指定的链接时,触发ahk脚本执行,能否给个实例?

Post by gongnl » 20 Mar 2017, 04:12

请教大神,点击ie网页中指定的链接时,触发ahk脚本提取打开的网页中的字段,能否给个实例,谢谢
gongnl
Posts: 72
Joined: 05 Jan 2015, 03:57
Location: /gongnltmp/

Re: 点击网页中指定的链接时,触发ahk脚本执行,能否给个实例?

Post by gongnl » 20 Mar 2017, 07:57

我找了个类似例子:

Code: Select all

Gui Add, ActiveX, w500 h300 vwb, Shell.Explorer
wb.Navigate("http://ahkscript.org")
while wb.busy
	sleep 100
doc := wb.document
ComObjConnect(doc, "Doc_")
Gui, Show
Return

GuiClose:
ExitApp

Doc_OnClick(doc) {
    MsgBox, % doc.parentWindow.event.srcElement.OuterHtml
}
修改如下:

Code: Select all

#Persistent
wb := ComObjCreate("InternetExplorer.Application")
wb.Navigate("http://www.baidu.com")
while wb.busy
	sleep 100
doc := wb.document
ComObjConnect(doc, "Doc_")
Return

Doc_OnClick(doc) {
    MsgBox, % doc.parentWindow.event.srcElement.OuterHtml
}
ok
gongnl
Posts: 72
Joined: 05 Jan 2015, 03:57
Location: /gongnltmp/

Re: 点击网页中指定的链接时,触发ahk脚本执行,能否给个实例?

Post by gongnl » 10 May 2017, 01:58

当点击qq邮箱登录页面frame中的 元素时,却无法返回doc.parentWindow.event.srcElement.OuterHtml信息,请教高手将如何返回点击处的元素连接
代码如下:

Code: Select all

#Persistent
wb := ComObjCreate("InternetExplorer.Application")
wb.visible := True
wb.Navigate("https://mail.qq.com/cgi-bin/loginpage")
while wb.busy
	sleep 100
doc := wb.document
ComObjConnect(doc, "Doc_")
Return
  
Doc_OnClick(doc) {
    MsgBox, % doc.parentWindow.event.srcElement.OuterHtml
}
Post Reply

Return to “请求帮助”