SoLongAndTFATF
SoLongAndTFATF

Reputation: 43

How to ignore key if it comes from script, but fire it if it comes from keyboard in AHK?

I am trying to make a script that would fire a key if it comes from user, but not from script in AutoHotKey.

How can achieve this: if a is pressed - ab is typed. if b is pressed - c is fired.

Upvotes: 2

Views: 351

Answers (2)

Stepan
Stepan

Reputation: 1431

You can use ~a::b as a sign of "send a through, then send b".

If you are to use that three line method - you would need to use $ to avoid infinite a:: firing:

 $a::   
 Send {a}{b}  
 Return  

This works as expected.

Upvotes: 2

Fghoip
Fghoip

Reputation: 21

Use this

~a::b
b::c

You can also do

$a::
Send {a}{b}
Return

Both work, but first is cleaner.

Fixed a bug.

Upvotes: 2

Related Questions