您的位置:首页 > 其它

AutoIT: 如何通过坐标相对位置来对无法识别的Menu以及GridView进行定位点击操作

2013-08-16 15:59 1131 查看
一般情况下,GridView中的数据来自数据库,我们通过Windows Info,是无法获取GridView中的信息的。
而软件定制的Menu,很多时候无法通过系统提供的WinMenuSelectItem来获取。
对于GridView窗口或者WinMenuSelectItem窗口等等,如果无法通过常规手段获取的资源,都可以使用ControlClick和ControlSetText命令对字段进行点击/双击/赋值操作。

;Get the handle of the main window
$handle = WinGetHandle("[class:WindowsForms10.Window.20008.app.0.1f550a4_r15_ad1]")
;Double Click on a defined pos(200, 120)
ControlClick($handle,"","WindowsForms10.Window.8.app.0.1f550a4_r15_ad129","left",2, 200, 120)
$str2 = "0000-0000-0000-0000-02" & Random(10,99,1)
Sleep(10)
; Send the text to an edit box
ControlSetText($handle,"", "WindowsForms10.EDIT.app.0.1f550a4_r15_ad11",$str2)

;Click a menu by pos(30, 10)
ControlClick($handle,"", "WindowsForms10.Window.8.app.0.1f550a4_r15_ad136", "left",1, 30, 10)
Sleep(10)

$handle2 = WinGetHandle("[class:WindowsForms10.Window.20808.app.0.1f550a4_r15_ad1]")
ControlClick($handle2,"", "", "left", 1,50, 80)
WinWaitActive("[Title:Save .NET Reactor Project File As..]")
$handle3 = WinGetHandle("[title:Save .NET Reactor Project File As..]")
ControlSetText($handle3,"","Edit1","D:\test\abcdefgg.nrproj")
ControlClick($handle3,"", "Button1")
WinWaitActive("确认另存为")
$handle4 = WinGetHandle("确认另存为")
ControlClick($handle4,"","Button2")
ControlSetText($handle3,"","Edit1","D:\test\abcdefggffffg.nrproj")
ControlClick($handle3,"", "Button1")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐