Help with Right Click hold

Ask gaming related questions (AHK v1.1 and older)
hrdlywrkng
Posts: 5
Joined: 28 Dec 2017, 17:44

Help with Right Click hold

15 Mar 2019, 23:22

Hello,

I'm trying to make a toggle macro, which does the following:

1. Pressing number 2 toggles the macro on and off
2. When macro toggle is on, hold down right mouse button
3. When left mouse button is clicked or held during toggle, pause everything for a second before continuing to hold right mouse button again

This is what I have so far, and I know it doesn't work, so if anyone could help, it would be greatly appreciated. Thanks!

Code: Select all

#MaxThreadsPerHotkey, 2

$2::
    Toggle := !Toggle
    While (Toggle) {
        if GetKeyState("LButton","p") {
            sleep 1000
            continue
        }
        else {
            send Click Right Down
            sleep 0
        }
    }
    return
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help with Right Click hold

27 Mar 2019, 04:16

Hallo,
try:

Code: Select all

*2::
IF Toggle := !Toggle
	Send, {Blind}{RButton DownR}
Else
{
	SetTimer, RButton_Down, Off
	Send, {Blind}{RButton Up}
}
Return
#If Toggle
~*LButton::Send, {Blind}{RButton Up}
~*LButton Up::SetTimer, RButton_Down, -1000
; a second before continuing to hold right mouse button
#If
RButton_Down:
If Toggle
	Send, {Blind}{RButton DownR}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Shoobis and 39 guests