梦想 发表于 2017-9-20 11:16:48

求助: 请问为什么controlclick不能根据文本点击?

Local $e = WinGetHandle ("", "")
;MsgBox($MB_SYSTEMMODAL, "", $e)
Local $button = ControlGetHandle ($e, "", "")
;MsgBox($MB_SYSTEMMODAL, "", $button)
ControlClick ("Confirm Uninstall", "", "")


zghwelcome 发表于 2017-9-20 12:32:25

应该是可以的,你看看是否可以获取控件的句柄

梦想 发表于 2017-9-20 16:01:57

能获取控件句柄,不知道是不是窗口没被激活?
如果改成Cancel, 运行后cancel button并不会被选中
ControlClick ($e, "Confirm Uninstall","")

梦想 发表于 2017-9-20 17:48:13

Local $e = WinGetHandle ("", "")
Local $button = ControlGetHandle ($e, "", "")
MsgBox($MB_SYSTEMMODAL, "", $button)
Local $position = ControlGetPos($button, "", "")
MsgBox($MB_SYSTEMMODAL, "", "Position: " &$position & ", " &$position & @CRLF & "Size: " &$position & ", " & $position)
Local $move =ControlMove($e, "OK", "", "$position", "$position", "$position", "$position")
MsgBox($MB_SYSTEMMODAL, "", $move)
Send ("!a")
使光标移到button上面直接关闭也不行,请问这到底什么原因?

fybhwsx 发表于 2017-9-20 19:21:54

有窗口,有控件,应该能控制吧。似乎是你函数参数没用对?比如
Local $position = ControlGetPos($button, "", "这里应该有控件才对吧?")

fybhwsx 发表于 2017-9-20 19:24:17

如一楼所说点击OK
这样应该就行了,我都是这么用的。ControlClick ("Confirm Uninstall", "", "Button1")

梦想 发表于 2017-9-21 17:54:01

回复 5# fybhwsx

Local $e = WinGetHandle ("")
;MsgBox($MB_SYSTEMMODAL, "", $e)
WinWait("","",10)
If WinExists("Confirm Uninstall", "OK") Then
      MsgBox($MB_SYSTEMMODAL, "", "Window exists")
   Else
      MsgBox($MB_SYSTEMMODAL, "", "Window does not exist")
   EndIf
   Local $button = ControlGetHandle ($e, "OK", "")
   MsgBox($MB_SYSTEMMODAL, "", $button)
   Local $position = ControlGetPos($e, "OK", "")
   MsgBox($MB_SYSTEMMODAL, "", "Position: " &$position & ", " &$position & @CRLF & "Size: " &$position & ", " & $position)
   Local $R = ControlClick ("Confirm Uninstall", "OK", "", "left", 2, $position-60, 10)
   MsgBox($MB_SYSTEMMODAL, "", $R)
   
controlclick返回值也是1, 请教一下,怎么知道click在哪里呢?感谢

柚子爸爸 发表于 2017-9-24 08:49:29

学习 学习正好遇到此类问题
页: [1]
查看完整版本: 求助: 请问为什么controlclick不能根据文本点击?