I'm making an AutoHotkey script that, when a window with a certain title or class ID appears, draws a region inside it. The problem is that sometimes multiple such windows can appear, all having the same title and class ID. In that case my script cannot detect them all and only draws a region inside the active window.
Is it possible to get a list of handles of all windows matching the title or class ID or in some other way cycle through all of them in AHK? Thanks
WinGet
with the list
command will produce an array of handles
Winget, id, list, MyTitle
then loop through them, and process...
from the help file:
; 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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With