Listen to hotkey when GUI is shown

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jaccotjuhhh
Posts: 27
Joined: 16 Mar 2018, 08:45

Listen to hotkey when GUI is shown

13 Apr 2018, 08:38

I wasn't sure if i would have to combine both questions in one topic. But since they're kind of different, i chose to make different topics.

I have the following code going:

Code: Select all

 #if winactive("STANDBY")
    Lctrl & numpad7::
    guistandbyWO:
    gui WO:show
    gui standby:hide
    return
#if
This code is pretty straight forward. If i press ctrl+7, i will hide my STANDBY gui, and show my WO gui. But this hotkey only works when STANDBY gui is the active window, in Windows.
Is it possible to change this behavior in a way that it listens to my hotkey, when a certain GUI is SHOWN?
Something like:

Code: Select all

 #if GUISHOWN("STANDBY")
    Lctrl & numpad7::
    guistandbyWO:
    gui WO:show
    gui standby:hide
    return
#if


So when my STANDBY gui is hidden, it will not perform action with that hotkey.
This is mostly useful as i have the gui alwaysontop in a corner, and i want to call functions by hotkey. Without having to activate the window.
The reason why i cannot just remove the IF statement, is because i want my ctrl+7 to perform a different task when GUI WO is shown.
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: Listen to hotkey when GUI is shown

13 Apr 2018, 09:13

Try #if WinExist. This does not, by default anyway, detect hidden windows, so it should work.
try it and see
...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: bobstoner289, peter_ahk and 337 guests