Author Topic: Enable Hotkeys when window regains focus  (Read 775 times)

Squeeze

  • Newbie
  • *
  • Posts: 25
Enable Hotkeys when window regains focus
« on: May 07, 2021, 06:40:52 AM »
I made a profile which disables hotkeys when pressing Win Key. Now i need to re-enable the hotkeys when my window regains focus. Any idea how to do this? Could VA support this, please!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Enable Hotkeys when window regains focus
« Reply #1 on: May 07, 2021, 07:37:16 PM »
You could add a loop to the command you're using to disable hotkeys that uses the "{ACTIVEWINDOWTITLE}" token to check which window has focus, so that the loop stops if it's your target window, and the next action can re-enable hotkeys.

You may want to add a second loop before the first one that waits until the active window is no longer the target window (as otherwise hotkeys would be re-enabled instantly if you execute the command while your target window still has focus).

In addition, you may also want to add a check to the loop that stops the command if hotkeys are re-enabled some other way (E.G. if you click the button on the main window)