18
votes

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.

2

2 Answers

29
votes
$~^a::

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

4
votes

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