找回密码
 加入
搜索
查看: 1544|回复: 4

[AU3基础] 【已解决】关于 WinGetClassList 的返回数据

[复制链接]
发表于 2019-9-23 09:53:17 | 显示全部楼层 |阅读模式
本帖最后由 chishingchan 于 2019-9-23 10:28 编辑
$Title = "标题名称"
Local $hWnd = WinWait($Title, "", 10)
WinActivate($hWnd)
Local $sClassList = WinGetClassList($hWnd)
MsgBox(64,"类列表",$sClassList)


请问:如何让 WinGetClassList(或其他) 显示 NN 序列?即 Button1、...、Button7、Static1、...、Startic7。谢谢!

参考图:


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2019-9-23 09:56:44 | 显示全部楼层
是不是每个窗口的类列表的控件名称NN必须是由1开始并递增?
发表于 2019-9-23 10:02:32 | 显示全部楼层
chishingchan 发表于 2019-9-23 09:56
是不是每个窗口的类列表的控件名称NN必须是由1开始并递增?

是的,就是以1开始递增

评分

参与人数 1威望 +2 金钱 +50 贡献 +10 收起 理由
chishingchan + 2 + 50 + 10 很给力!

查看全部评分

 楼主| 发表于 2019-9-23 11:01:02 | 显示全部楼层
本帖最后由 chishingchan 于 2019-9-23 11:02 编辑
afan 发表于 2019-9-23 10:02
是的,就是以1开始递增

a大,可否帮忙编写脚本,像上面的例子输出为
Button1
...
Button7
Static1
...
Static7
注:Button 和 Static 的字眼不能在脚本上直接明示
发表于 2019-9-23 11:12:00 | 显示全部楼层
本帖最后由 afan 于 2019-9-23 11:19 编辑
chishingchan 发表于 2019-9-23 11:01
a大,可否帮忙编写脚本,像上面的例子输出为
Button1
...
$Title = "标题名称"
Local $hWnd = WinWait($Title, "", 10)
WinActivate($hWnd)
$sClassList = _WinGetClassListNum($hWnd)
MsgBox(64,"类列表", $sClassList)
Func _WinGetClassListNum($hWnd)
        Local $sClassList = WinGetClassList($hWnd)
        Local $aC = StringRegExp($sClassList, '\V+', 3)
        If @error Then Return SetError(1, 0, '')
        Local $sOut = '', $ix
        For $ii = 0 To UBound($aC) - 1
                If IsDeclared($aC[$ii]) Then ContinueLoop
                Assign($aC[$ii], 0)
                $ix = 0
                Do
                        $ix += 1
                        If Not ControlGetHandle($hWnd, '', $aC[$ii] & $ix) Then ExitLoop
                        $sOut &= $aC[$ii] & $ix & @LF
                Until 0
        Next
        Return $sOut
EndFunc   ;==>_WinGetClassListNum

评分

参与人数 1威望 +2 金钱 +50 贡献 +6 收起 理由
chishingchan + 2 + 50 + 6 很给力!

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 07:24 , Processed in 0.213955 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表