So I have an auto-repeatkey macro that spams a key until release.
Here it is (credit to reddit AHK mod for making this):
Code: Select all
; ========== AES ==========
; Only 1 instance of the script can run
#SingleInstance Force
#MaxThreadsPerHotkey 2
; Runs script at full speed
SetBatchLines, -1
; Creates your hotkeys
MakeHotkeys()
; End of AES
;SetBatchLines, -1
Exit
; ========== Hotkeys ==========
*PgUp::Suspend, Toggle
~*$Tab::SendInput, {Tab}
~*$Space::SendInput, {Space}
~*$F::SendInput, F
; ========== Functions ==========
; Handles all autofire hotkeys
AutoFire(key){
SendInput, % key
If GetKeyState(key, "P")
{
bf := Func(A_ThisFunc).bind(key)
SetTimer, % bf, -1
}
Return
}
; Dynamically creates all the hotkeys
MakeHotkeys(){
keyArr := ["r", "b", "v", "q", "c", "t", "e", "x", 1, 2, 3, 4]
for index, key in keyArr
{
bf := Func("AutoFire").bind(key)
Hotkey, % "*$" key, % bf, On
}
Return
}
Code: Select all
loop
{
SendInput, r
Sleep, 1
SendInput, r
} until !GetKeyState("r", "P")
return
Code: Select all
while GetKeyState("r","P")
{
SendInput, r
Sleep, 1
SendInput, r
}
return