Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autohotkey, How to NOT consume the key being pressed?

Tags:

autohotkey

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.

like image 924
user1032613 Avatar asked Oct 17 '12 17:10

user1032613


People also ask

Can AutoHotkey record keystrokes?

AutoHotkey definitely does not have built-in recording capabilities--you would need to use a third party macro recorder if you don't want to just code the macro from scratch.

How do I pause an AutoHotkey?

p::Pause ; Press Ctrl+Alt+P to pause.

How do you send a key multiple times AutoHotkey?

To repeat a keystroke: Enclose in braces the name of the key followed by the number of times to repeat it. For example: Send "{DEL 4}" ; Presses the Delete key 4 times. Send "{S 30}" ; Sends 30 uppercase S characters.


2 Answers

$~^a::

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

like image 110
Robert Ilbrink Avatar answered Sep 22 '22 15:09

Robert Ilbrink


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

like image 42
Jeff Kang Avatar answered Sep 24 '22 15:09

Jeff Kang