Created
March 1, 2024 23:35
-
-
Save ericchase/6d03568ea9abc7d1f5af8545fd146bd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires AutoHotkey >=2.0 <2.1 | |
#SingleInstance Force | |
#UseHook true | |
DetectHiddenWindows true | |
FileEncoding "UTF-8" | |
SendMode "Event" ; Event mode intersperses delays between actions. Needed for games. | |
SetTitleMatchMode 3 ; A window's title must exactly match WinTitle to be a match. | |
Thread "Interrupt", 15 ; Sets the priority or interruptibility of threads. | |
; This code restarts the script in admin mode if needed. | |
g_CommandLine := DllCall("GetCommandLine", "str") | |
if not A_IsAdmin or not RegExMatch(g_CommandLine, " /restart(?!\S)") { | |
try { | |
if A_IsCompiled { | |
Run('*RunAs "' A_ScriptFullPath '" /restart') | |
} | |
else { | |
Run('*RunAs "' A_AhkPath '" /restart "' A_ScriptFullPath '"') | |
} | |
} | |
ExitApp | |
} | |
g_X := 0 | |
g_Y := 0 | |
g_Toggle_Click := false | |
fn_RepeatClick() { | |
global | |
if (g_Toggle_Click = true) { | |
MouseClick("Left", g_X, g_Y, 1, 0, "D") | |
Sleep(50) | |
MouseClick("Left", , , , 0, "U") | |
Send("x") | |
SetTimer(fn_RepeatClick, -250) | |
} else { | |
Send("{y up}") | |
SetTimer(fn_RepeatClick, 0) | |
} | |
} | |
fn_ToggleRepeatClick() { | |
global | |
g_Toggle_Click := !g_Toggle_Click | |
SetTimer(fn_RepeatClick, 0) | |
if (g_Toggle_Click = true) { | |
MouseGetPos(&g_X, &g_Y) | |
Send("{y down}") | |
Sleep(1000) | |
fn_RepeatClick() | |
} else { | |
Send("y") | |
} | |
} | |
*XButton2:: fn_ToggleRepeatClick | |
~Escape:: { | |
global | |
g_Toggle_Click := false | |
Send("y") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment