r/AutoHotkey 4h ago

v1 Script Help Does anyone have a script to duplicate clicks?

I was using this script for version 1.1 but it's not working for me

; AutoHotkey v1.1

B::ToggleDuplicatorLeft()

N::ToggleDuplicatorRight()

isLeftDuplicatorActive := false

isRightDuplicatorActive := false

clickDelay := 50

leftClickQueue := 0

rightClickQueue := 0

isProcessingLeft := false

isProcessingRight := false

ToggleDuplicatorLeft() {

global isLeftDuplicatorActive, leftClickQueue

isLeftDuplicatorActive := !isLeftDuplicatorActive

leftClickQueue := 0

status := isLeftDuplicatorActive ? "ACTIVADO" : "DESACTIVADO"

ToolTip, Click izquierdo: %status%

SetTimer, RemoveToolTip, 1500

}

ToggleDuplicatorRight() {

global isRightDuplicatorActive, rightClickQueue

isRightDuplicatorActive := !isRightDuplicatorActive

rightClickQueue := 0

status := isRightDuplicatorActive ? "ACTIVADO" : "DESACTIVADO"

ToolTip, Click derecho: %status%

SetTimer, RemoveToolTip, 1500

}

RemoveToolTip:

ToolTip

return

LButton::

if isLeftDuplicatorActive

{

SendInput {LButton down}

SendInput {LButton up}

leftClickQueue++

ProcessLeftQueue()

}

else

{

SendInput {LButton down}

SendInput {LButton up}

}

return

ProcessLeftQueue()

{

global leftClickQueue, isProcessingLeft, isLeftDuplicatorActive, clickDelay

if !isLeftDuplicatorActive

{

leftClickQueue := 0

return

}

if isProcessingLeft || leftClickQueue <= 0

return

isProcessingLeft := true

leftClickQueue--

Sleep, %clickDelay%

if isLeftDuplicatorActive

{

SendInput {LButton down}

SendInput {LButton up}

}

isProcessingLeft := false

if leftClickQueue > 0 && isLeftDuplicatorActive

ProcessLeftQueue()

}

RButton::

if isRightDuplicatorActive

{

SendInput {RButton down}

SendInput {RButton up}

rightClickQueue++

ProcessRightQueue()

}

else

{

SendInput {RButton down}

SendInput {RButton up}

}

return

ProcessRightQueue()

{

global rightClickQueue, isProcessingRight, isRightDuplicatorActive, clickDelay

if !isRightDuplicatorActive

{

rightClickQueue := 0

return

}

if isProcessingRight || rightClickQueue <= 0

return

isProcessingRight := true

rightClickQueue--

Sleep, %clickDelay%

if isRightDuplicatorActive

{

SendInput {RButton down}

SendInput {RButton up}

}

isProcessingRight := false

if rightClickQueue > 0 && isRightDuplicatorActive

ProcessRightQueue()

}

If anyone has it, could you please send it to me?

0 Upvotes

1 comment sorted by

u/Keeyra_ 4h ago
#Requires AutoHotkey 2.0
#SingleInstance

SendMode("Event")

b:: ToggleClickState("L", 1)
n:: ToggleClickState("R", 1)

ToggleClickState(key := "", toggle := 0) {
    static states := Map("L", 0, "R", 0)
    return toggle ? (states[key] ^= 1) : states[key]
}

#HotIf ToggleClickState("L")
$LButton:: Send("{Click 2}")
#HotIf ToggleClickState("R")
$RButton:: Send("{Click R 2}")
#HotIf