autoit获取ie浏览器简单操作网页(GUI小工具)

需要稍稍熟悉一下autoti提供的语言,

我简单做了一个带GUI的小工具,实现根据IE标题点击页面内的LinkText

注意:使用时IE窗口是显示状态才可以获取到(可以在脚本中加入搜索IE句柄,将ie显示出来)

#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>           #以上为导入的文件
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("resource access", 300, 153, 192, 124)
$Input1 = GUICtrlCreateInput("", 56, 24, 217, 21)
$Input2 = GUICtrlCreateInput("", 56, 64, 217, 21)
$Button1 = GUICtrlCreateButton("access", 32, 104, 219, 25)
$Label1 = GUICtrlCreateLabel("IE标题", 16, 24, 36, 17)
$Label2 = GUICtrlCreateLabel("链接名", 16, 64, 36, 17)
$Label3 = GUICtrlCreateLabel("-G", 285, 140, 36, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###           #以上为创建GUI窗体

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			$inputtitle=GUICtrlRead($Input1)
			$inputlink=GUICtrlRead($Input2)          #获取控件内容
			Local $oIE = _IEAttach($inputtitle, "dialogbox")       #获取IE窗口
			_IELinkClickByText($oIE, $inputlink)                  #点击LinkText
	EndSwitch
WEnd
 
原文地址:https://www.cnblogs.com/MrRead/p/9044818.html