Page 1 of 1

Mouse Right Hold + Left Click

Posted: 09 Jun 2021, 05:41
by Samson2
Hello friends.

I'm looking for the following script (if possible).

I need an "autoclicker" for the left mouse button. However, this should only be activated if the right mouse button is held. If possible with an adjustable delay on the left mouse button and an "Off" button (insert button).

I would be very happy. :)

My Basic-Script:

Code: Select all

Insert::
  Hotkey, LButton, Toggle
  Hotkey, LButton Up, Toggle
Return
LButton::
  Loop
  {
     If (Stop)
        Break
     Send {lbutton}
  }
  Stop := 0
Return
LButton Up::Stop := 1

Re: Mouse Right Hold + Left Click

Posted: 09 Jun 2021, 17:11
by YoucefHam
Hi try this

Code: Select all

Delay := 500 ;1000 ms = 1 second

*Insert::
RB_Toggle := !RB_Toggle
SoundBeep, % (RB_Toggle ? 2000 : 600)
return

#if RB_Toggle ; and WinActivate("ahk_exe notepad.exe")

~*RButton::
Loop {
	SendInput, {LButton Down}
	Sleep, 62
	SendInput, {LButton Up}
	Sleep, % Delay
}until !GetKeyState("RButton","P")
return

#if

Re: Mouse Right Hold + Left Click

Posted: 09 Jun 2021, 17:35
by Samson2
That's good but ... I want to hold down the left mouse button and let it "click". As if I were clicking myself, only that I hold it down.

Thank you for your support.

Re: Mouse Right Hold + Left Click

Posted: 09 Jun 2021, 17:47
by YoucefHam
this on send clicks when holding bouth Right and Left

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Delay := 200 ;1000 ms = 1 second

*Insert::
RB_Toggle := !RB_Toggle
SoundBeep, % (RB_Toggle ? 2000 : 600)
return

#if RB_Toggle ; and WinActivate("ahk_exe notepad.exe")

~*RButton::
LB_Toggle := 1
return

~*RButton up::
LB_Toggle := 0
return
#if LB_Toggle ; and WinActivate("ahk_exe notepad.exe")

~*LButton::
Loop {
	SendInput, {LButton Down}
	Sleep, 62
	SendInput, {LButton Up}
	Sleep, % Delay
	if !GetKeyState("RButton","P")
		break
}until !GetKeyState("LButton","P")
return

#if
and this one just hold Left

Code: Select all

Delay := 200 ;1000 ms = 1 second

*Insert::
LB_Toggle := !LB_Toggle
SoundBeep, % (LB_Toggle ? 2000 : 600)
return

#if LB_Toggle ; and WinActivate("ahk_exe notepad.exe")

~*LButton::
Loop {
	SendInput, {LButton Down}
	Sleep, 62
	SendInput, {LButton Up}
	Sleep, % Delay
	if !LB_Toggle
		break
}until !GetKeyState("LButton","P")
return

#if

Re: Mouse Right Hold + Left Click

Posted: 09 Jun 2021, 18:26
by Samson2
The second is almost perfect, but it should only work if the right mouse button is held. So when I'm in scope.

Thank you so much for the effort!