Turbo left + right click Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Dijanigo
Posts: 14
Joined: 06 Aug 2017, 13:09

Turbo left + right click

21 Oct 2022, 06:47

Hey guys!

This one is probably simple for you, but i just can't get it to work.

My goal:
I want to have rapid/turbo clicking on both left and right mouse click. the speed should be really fast, but not inhuman. I went to clickspeedtest and it showed an avg of 9 clicks per second.

Basically, i just want the script to spam left or right click whenever i hold the respective button and spam both one after the other if i hold both buttons. Holding both Lbutton and Rbutton together should either play the sequence 'left click -> right click -> left click -> right click' or just spam both at the same time.

I hope you get what i want, my english isn't the best :angel:

This is what i figured out so far, but it acts weird and sometimes spams left button when i right click.

Code: Select all

~$LButton::
    While GetKeyState("LButton", "P"){
        Click
        Sleep 5  ;  milliseconds
    }
return

~$RButton::
    While GetKeyState("RButton", "P"){
        Click
        Sleep 5  ;  milliseconds
    }
return
I greatly appreciate any help, thanks in advance
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Turbo left + right click

21 Oct 2022, 08:58

See syntax for :arrow: Click.
WhichButton: Left (default), Right, Middle (or just the first letter of each of these); or the fourth or fifth mouse button (X1 or X2). For example, Click, Right clicks the right mouse button at the mouse cursor's current position. Unlike MouseClick, the left and right buttons behave consistently across all systems, even if the user has swapped the buttons via the system's control panel.

Code: Select all

LButton::
RButton::
While GetKeyState("LButton", "P") | GetKeyState("RButton", "P")
 Send % (GetKeyState("LButton", "P") ? "{LButton}" : "") (GetKeyState("RButton", "P") ? "{RButton}" : "")
Return
Dijanigo
Posts: 14
Joined: 06 Aug 2017, 13:09

Re: Turbo left + right click

21 Oct 2022, 10:30

Thank you so much for the code mikey.

it works great except for the fact that sometimes it won't stop clicking even when i let go of the buttons. i'm then stuck in an endless clicking orgy and have no choice but force-closing the AHK script.

What could be the reason for that?
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Turbo left + right click

21 Oct 2022, 10:41

Code: Select all

LButton::
RButton::
SetKeyDelay, 20 ; Adjust as needed
While GetKeyState("LButton", "P") | GetKeyState("RButton", "P")
 Send % (GetKeyState("LButton", "P") ? "{LButton}" : "") (GetKeyState("RButton", "P") ? "{RButton}" : "")
Return
I find with my trackball that when both buttons are held, the device will occasionally fail to recognize the release of one of the buttons. Other devices may behave more appropriately!
Dijanigo
Posts: 14
Joined: 06 Aug 2017, 13:09

Re: Turbo left + right click

21 Oct 2022, 11:00

Yeah i'm having the same issues.

I think it would be better to run the script without the 'both buttons pressed at the same time' function, it's not needed at all. i'd be glad if you could be help out one more time. So basically, just left click spam on hold and right click spam on hold.

Which line would i have to delete?
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Turbo left + right click  Topic is solved

21 Oct 2022, 11:15

Your original script is OK, but as already noted, to click right:

Code: Select all

Click, R
As documentation notes, adding $ to mouse hotkeys has no effect, because mouse hotkeys always use the hook and, furthermore, hotkeys using tilde also always use the hook.
Dijanigo
Posts: 14
Joined: 06 Aug 2017, 13:09

Re: Turbo left + right click

21 Oct 2022, 11:35

Thanks once again mikey, have a nice day :clap:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 328 guests