【问题标题】:Autohotkey: get list of windows with a certain titleAutohotkey:获取具有特定标题的窗口列表
【发布时间】:2012-05-31 04:44:29
【问题描述】:

我正在制作一个 AutoHotkey 脚本,当具有特定标题或类 ID 的窗口出现时,它会在其中绘制一个区域。问题是有时会出现多个这样的窗口,它们都具有相同的标题和类 ID。在这种情况下,我的脚本无法全部检测到它们,只能在活动窗口内绘制一个区域。

是否可以获得与标题或类 ID 匹配的所有窗口的句柄列表,或者以其他方式在 AHK 中循环遍历所有窗口?谢谢

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    WinGetlist 命令将生成一个句柄数组

    Winget, id, list, MyTitle 然后循环遍历它们,并处理...

    来自帮助文件:

    ; Example #2: This will visit all windows on the entire system and display info about each of them:
    WinGet, id, list,,, Program Manager
    Loop, %id%
    {
        this_id := id%A_Index%
        WinActivate, ahk_id %this_id%
        WinGetClass, this_class, ahk_id %this_id%
        WinGetTitle, this_title, ahk_id %this_id%
        MsgBox, 4, , Visiting All Windows`n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n`nContinue?
        IfMsgBox, NO, break
    }
    

    【讨论】:

      猜你喜欢
      • 2012-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-28
      • 1970-01-01
      相关资源
      最近更新 更多