探测结果为button实际上是单选的怎么自动发送点击?
试过用模拟点击却不行,貌似没定到焦点,controlclick是无效的。就是product is registered to里面两个点选框有的控件會被別的控件蓋住
要去list all control
再去看空件的文本比對
#include <Array.au3>
#include <WinAPI.au3>
ConsoleWrite("Make your window active!" & @CRLF)
Sleep(5000)
GetAllWindowsControls(WinGetHandle(""))
Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible=Default, $sStringIncludes=Default, $sClass=Default)
If Not IsHWnd($hCallersWindow) Then
ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF)
Return False
EndIf
; Get all list of controls
If $bOnlyVisible = Default Then $bOnlyVisible = False
If $sStringIncludes = Default Then $sStringIncludes = ""
If $sClass = Default Then $sClass = ""
$sClassList = WinGetClassList($hCallersWindow)
; Create array
$aClassList = StringSplit($sClassList, @CRLF, 2)
; Sort array
_ArraySort($aClassList)
_ArrayDelete($aClassList, 0)
; Loop
$iCurrentClass = ""
$iCurrentCount = 1
$iTotalCounter = 1
If StringLen($sClass)>0 Then
For $i = UBound($aClassList)-1 To 0 Step - 1
If $aClassList[$i]<>$sClass Then
_ArrayDelete($aClassList,$i)
EndIf
Next
EndIf
For $i = 0 To UBound($aClassList) - 1
If $aClassList[$i] = $iCurrentClass Then
$iCurrentCount += 1
Else
$iCurrentClass = $aClassList[$i]
$iCurrentCount = 1
EndIf
$hControl = ControlGetHandle($hCallersWindow, "", "")
$text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
$aPos = ControlGetPos($hCallersWindow, "", $hControl)
$sControlID = _WinAPI_GetDlgCtrlID($hControl)
$bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible")
If $bOnlyVisible And Not $bIsVisible Then
$iTotalCounter += 1
ContinueLoop
EndIf
If StringLen($sStringIncludes) > 0 Then
If Not StringInStr($text, $sStringIncludes) Then
$iTotalCounter += 1
ContinueLoop
EndIf
EndIf
If IsArray($aPos) Then
ConsoleWrite("Func=: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos) & "] YPos=[" & StringFormat("%4s", $aPos) & "] Width=[" & StringFormat("%4s", $aPos) & "] Height=[" & StringFormat("%4s", $aPos) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $text & "]." & @CRLF)
Else
ConsoleWrite("Func=: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos= YPos= Width= Height= Text=[" & $text & "]." & @CRLF)
EndIf
If Not WinExists($hCallersWindow) Then ExitLoop
$iTotalCounter += 1
Next
EndFunc ;==>GetAllWindowsControls mars0916 发表于 2018-6-27 12:56
有的控件會被別的控件蓋住
要去list all control
再去看空件的文本比對
朋友这个怎么调用,func是用includ调用吗? 本帖最后由 mars0916 于 2018-6-27 16:16 编辑
friendtasy 发表于 2018-6-27 16:01
朋友这个怎么调用,func是用includ调用吗?
我有貼代碼
要再SCITE裡執行
結果會在console裡
直接用他來列出所有的控件按下F5 會有5秒等待時間
這時把要列出控件的視窗用在最上層
他就會列出來了
mars0916 发表于 2018-6-27 16:11
我有貼代碼
要再SCITE裡執行
結果會在console裡
不知为什么马上就结束了,提示如下。
C:\DocumentsSettings\Administrator\??\?? AutoIt3 ??.au3 (14) : ==> ????????.:
?
^ ERROR
->20:07:08 AutoIt3.exe 结束.rc: 1
+>20:07:08 AutoIt3Wrapper 完成脚本处理.
>Exit code: 1 Time: 0.5901
噢,可以了,可能复制的方式有问题,再研究一下了,非常感谢朋友的无私帮助。 果然可以的,再次感谢 我一般模拟键盘TAB键盘来选择
页:
[1]