how to disable "Hotkey, IfWinNotActive" ? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Flowgun
Posts: 75
Joined: 25 Aug 2022, 09:42

how to disable "Hotkey, IfWinNotActive" ?

Post by Flowgun » 05 Feb 2023, 08:16

Hello everyone,
so... when I use "Hotkey, IfWinNotActive" (or Hotkey, IfWinNotActive), with an application, let's say chrome, I do it like this:

Code: Select all

Hotkey, IfWinNotActive, ahk_exe chrome.exe
then, to get back to regular hotkey setting, I just use a random string that can't be an open application:

Code: Select all

Hotkey, IfWinNotActive, asdfgasdg
I still find this solution absurd.
Is there a more elegant way to do it?

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: how to disable "Hotkey, IfWinNotActive" ?  Topic is solved

Post by mikeyww » 05 Feb 2023, 08:44

Yes, the elegance is in the documentation for Hotkey.
To turn off context sensitivity (that is, to make subsequently-created hotkeys work in all windows), specify any If sub-command but omit the parameters. For example: Hotkey, If or Hotkey, IfWinActive.

Post Reply

Return to “Ask for Help (v1)”