Check if a WinID is in a WinGroup Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

Check if a WinID is in a WinGroup

03 Dec 2018, 16:47

Hello, folks...

I know the ahk_id of a window and I want to know if that window is in a specific ahk_group.

Is there a clever way to check?

Should "IfWinExist, ahk_ID %MyWinID% ahk_group %MyWinGroup%" work? It's not working for me. Wondering if I'm just missing something.

:?:
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Check if a WinID is in a WinGroup  Topic is solved

03 Dec 2018, 17:30

- The idea appears to work for me.
- Sometimes hotkey subroutines fail to run if the active window is admin, and AHK is not admin. Cheers.

Code: Select all

q:: ;test ahk_id combined with ahk_group
DetectHiddenWindows, Off
GroupAdd, WinGroup, ahk_class Notepad
GroupAdd, WinGroup, ahk_class IEFrame
vWinGroup := "WinGroup"
WinGet, hWnd, ID, A
hWnd1 := WinExist("ahk_group " vWinGroup)
hWnd2 := WinExist("ahk_id " hWnd " ahk_group " vWinGroup)
MsgBox, % hWnd1 "`r`n" hWnd2
return
Last edited by jeeswg on 04 Dec 2018, 15:09, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

Re: Check if a WinID is in a WinGroup

04 Dec 2018, 14:56

Thanks, jeeswg, I modified your code and it's working now! :dance:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, gsxr1300, inseption86, jaka1, mebelantikjaya, mikeyww and 308 guests