I'm trying to make a script that repeatedly clicks left mouse button when I hold left control key with left mouse button at the same time
This is what I have so far:
function OnEvent(event, arg, family)
OutputLogMessage("clicked event = %s, arg = %s\n", event, arg);
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and Ctrl_Down == 1 then
repeat
PressMouseButton(1) //repeat while the left mouse button down
until not PressMouseButton(1)
else ReleaseMouseButton(3) //stop the repating on left mouse button up
end
end
Please note this is my first time looking over this type of coding as any help is greatly appreciated
First of all, you have to define EnablePrimaryMouseButtonEvents()
to enables event reporting for mouse button 1
To avoid any endless loop you have to put sleep()
;
Press left control key then left mouse button it will repeat the click until you release the left mouse button then release left control key the script should be stopped
Your final code should be like:
EnablePrimaryMouseButtonEvents(true);
function OnEvent(event, arg)
if IsModifierPressed("lctrl") then
repeat
if IsMouseButtonPressed(1) then
repeat
PressMouseButton(1)
Sleep(15)
ReleaseMouseButton(1)
until not IsMouseButtonPressed(1)
end
until not IsModifierPressed("lctrl")
end
end