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

一般情况下,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")

 

转载于:https://www.cnblogs.com/autotest/p/3262338.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值