Autohotkey: get a list of windows with a specific title

I am making an AutoHotkey script which, when a window appears with a specific name or class identifier, draws an area inside it. The problem is that sometimes several of these windows may appear, all of which have the same title and class identifier. In this case, my script cannot detect them and only draws an area inside the active window.

Is it possible to get a list of descriptors for all windows that correspond to the name or class identifier, or in any other way loop through all of them in AHK? Thanks

+6
source share
1 answer

WinGet with the list command WinGet array of descriptors

Winget, id, list, MyTitle , then swipe 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 } 
+5
source

Source: https://habr.com/ru/post/916574/


All Articles