Author Topic: Execute On Press, Terminate On Release  (Read 830 times)

TheDJMC

  • Newbie
  • *
  • Posts: 2
Execute On Press, Terminate On Release
« on: September 06, 2022, 03:01:42 PM »
Hi!

I'm trying to set up a simple 8 direction keypad on my keyboard for use within games. Is there a way to have a single activator key execute a press and hold command until the activator is released?

E.g. Num 1 only when pressed = Num 2 + Num 4 held down

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Execute On Press, Terminate On Release
« Reply #1 on: September 06, 2022, 03:06:46 PM »
You can use separate press and release keypress actions.
The most responsive way to do what you're describing is to use two separate commands, set to trigger from the same key, where the second command has the "Shortcut is invoked only when all keys are released" option enabled.

I.E. the first command, with the "Shortcut is invoked only when all keys are released" option disabled (unchecked), would contain
Code: [Select]
Press down NumPad 2 key
Press down NumPad 4 key

and the second command, with the "Shortcut is invoked only when all keys are released" option enabled (checked), would contain
Code: [Select]
Release NumPad 2 key
Release NumPad 4 key


You'll likely want to make sure the "Do not allow key to be passed through" option is enabled for both.

TheDJMC

  • Newbie
  • *
  • Posts: 2
Re: Execute On Press, Terminate On Release
« Reply #2 on: September 06, 2022, 04:17:51 PM »
Ahhhhhhhhhh, I see! Thank you for that! Works like a dream!