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

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM