WSBT
WSBT

Reputation: 36323

Autohotkey, How to NOT consume the key being pressed?

In Autohotkey, I want the key pressed to serve its original purpose, while executing some additional functions.

For example, upon pressing "^a", I'd like the "^a" to function as normal (e.g. Select All), and then send another "word".

I tried to repeat the key being pressed, i.e. the following:

^a::
send, ^a
send, word
return

However, if I send the triggering keys (^a) again, the function will become "recursive" and never end.

Upvotes: 20

Views: 14560

Answers (2)

Robert Ilbrink
Robert Ilbrink

Reputation: 7953

$~^a::

The ~ will pass the ^a code through when the code is executed, so you don't even need to repeat the send, ^a.

Upvotes: 34

Jeff Kang
Jeff Kang

Reputation: 279

I'm an Autohotkey beginner, but I think you use the "$" sign.

$^a::
send, ^a
send, word
return

This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself.

Hotkeys (Mouse, Joystick and Keyboard Shortcuts) > Introduction and Simple Examples > You can use the following > This is usually only

http://www.autohotkey.com/docs/Hotkeys.htm

Upvotes: 5

Related Questions