Binding L and R mousebuttons to one keypress

Ask gaming related questions (AHK v1.1 and older)
KeyshaJ
Posts: 2
Joined: 19 Oct 2017, 20:56

Binding L and R mousebuttons to one keypress

19 Oct 2017, 21:08

I am VERY new to AHK, and am trying to ease my gaming in GW2. My problem is, my joints in my fingers are going, so I need to minimize the use of them. Is there a way to map both Left and Right mouse buttons to press at the same time if I press the F1 key? And have them stay down until I release the button (i.e. I press F1 and hold it, and the computer/game recognizes it as me pressing and holding both mouse keys down. I let go, and both keys are relased)? In game, we run and turn by holding both down and moving the mouse. I still want to move this way, but can no longer hold the buttons on the mouse down for very long. I've done searches, and tried altering the answers i find, but none are working.

Thanks.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Binding L and R mousebuttons to one keypress

19 Oct 2017, 21:45

Your hotkey is F1. You can use either the Click command, which offers left/right and down/up (down is pressed, up is released) options to define what you want. To make the script wait for your key to be released, use the KeyWait parameter. Finish off your hotkey by putting a return at the end, which tells AHK "Don't execute any further lines" in this case. Alternatively to the Click command, you can use the Send command in much the same way. Your Left/Right mouse buttons are LButton and RButton, per Send documentation or KeyList; you can also specify an up/down state to those buttons/keys.

I think this script of yours should end up being 7 lines long.
KeyshaJ
Posts: 2
Joined: 19 Oct 2017, 20:56

Re: Binding L and R mousebuttons to one keypress

20 Oct 2017, 08:07

I know my hotkey is F1. I know what I want to do, but I don't know how to do it. I am not good at this stuff.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Binding L and R mousebuttons to one keypress

20 Oct 2017, 22:14

That is why I linked to these commands:

Click (use this 4 times total; two before and two after KeyWait)
KeyWait (use this once); see KeyList too
return (use this once)

That's 6 lines of commands, combined with your F1 hotkey as the first line, that's 7 lines you should expect.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: jameswrightesq, Shoobis and 76 guests