Reputation: 1
I've been trying to learn how to make this script on Autohotkey but gotta say their documentation is the complete opposite of noob-friendly and I can't seem to find any similar example either.
I'll try to describe what I intend: When A is pressed on the keyboard (if was PRESSED, not held down), change the RButton to behave as the LButton until I click it, which then makes it return to its normal RButton functions.
It sounds simple enough in my head but I can't make anything work for the life of me .__.
So I appreciate any help! Thanks in advance!
Upvotes: 0
Views: 147
Reputation: 1719
First you need to create a hotkey that listens for the a
key. You should be able to find all the information needed in the docs here - http://ahkscript.org/docs/Hotkeys.htm
Next you need to create your Rbutton
hotkey and make it conditional to detect if a
has been pressed. To do that you use the #if
directive. Make sure you're updated to the latest version of AHK otherwise this directive won't work.
Your final code would look something like this:
; Init toggle var as "0"
changeNextPress := 0
; Toggle the variable to "1"
; The ~ symbols allows the "a" key be captured without blocking it
~a::
changeNextPress := 1
return
; Only activate this key if the toggle variable is "1"
#if (changeNextPress == 1)
Rbutton::
; Since we only want one press, toggle the variable back to "0" again
changeNextPress := 0
Send, {LButton}
return
#if
Upvotes: 1