2) Working with this issue, for me raises this additional question if this is a valid code (using group to be exclude in another group):
GroupAdd, Chrome_WidgetWin, ahk_class Chrome_WidgetWin_1,,, ahk_group Chrome_WidgetWin_exclude ?
Thanks!
My example:
Code: Select all
SetTitleMatchMode, 1
SetTitleMatchMode, fast
DetectHiddenWindows, Off
;Negative Group
;GroupAdd, Chrome_WidgetWin_exclude, Program Manager
GroupAdd, Chrome_WidgetWin_exclude, ahk_exe explorer.exe ; instead of "Program Manager"
GroupAdd, Chrome_WidgetWin_exclude, ahk_exe Teams.exe
;Positive Group
GroupAdd, Chrome_WidgetWin, ahk_class Chrome_WidgetWin_0,,, ahk_exe Teams.exe
GroupAdd, Chrome_WidgetWin, ahk_class Chrome_WidgetWin_1,,, ahk_exe Teams.exe
;GroupAdd, Chrome_WidgetWin, ahk_class Chrome_WidgetWin_1,,, ahk_group Chrome_WidgetWin_exclude ; is this working ?
; WinGet-Test normal
WinGetTest("1","ahk_class Chrome_WidgetWin_1", "ahk_exe Teams.exe") ; Returns also Teams.exe windows
; WinGet-Test with groups
WinGetTest("2","ahk_group Chrome_WidgetWin", "ahk_group Chrome_WidgetWin_exclude") ; Returns also Teams.exe windows
; WinGet-Test with Regex (case insensitive)
SetTitleMatchMode,RegEx
WinGetTest("regex","i)ahk_class Chrome_WidgetWin_*", "i)ahk_exe Teams.exe*") ; Returns also Teams.exe windows
Exitapp
WinGetTest(testname,IncludeTitle,ExcludeTitle)
{
WinGet, List_Count, Count, %IncludeTitle%,,%ExcludeTitle%
msgbox Test#%testname%`nCount=%List_Count%
WinGet, List_, List, %IncludeTitle%,,%ExcludeTitle%
Loop, %List_% {
id:=List_%A_Index%
WinGet, this_ProcessName, ProcessName, ahk_id %id%
;if (this_ProcessName="teams.exe") ; workaround to exclude teams.exe
; continue
WinGetClass, this_class, ahk_id %id%
WinGetTitle, this_title, ahk_id %id%
WinGetText, this_text, ahk_id %id%
WinGetPos, X, Y, Width, Height, ahk_id %id%
WinActivate, ahk_id %id% ; Brings found window to front
msgbox Test#%testname%: %A_INDEX%/%List_Count%`n%this_ProcessName%`n%this_class%`n%this_title%`n%this_text%`n%X%, %Y%, %Width%, %Height%`n
}
}