Spam key with random intervals

Ask gaming related questions
minchewe
Posts: 1
Joined: 30 Dec 2023, 03:50

Spam key with random intervals

30 Dec 2023, 03:52

I need a macro that when i press 2 it spams 2 with random intervals from 1 - 10 seconds, and to stop the loop i have to press 2 or 3 (both 2 and 3 can cancel the loop)
User avatar
mikeyww
Posts: 28871
Joined: 09 Sep 2014, 18:38

Re: Spam key with random intervals

30 Dec 2023, 06:24

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0
on := False

$2::
3:: {
 Global on
 SetTimer go, on := ThisHotkey = 3 ? False : !on
 SoundBeep 1000 + 500 * on
}

go() {
 (on) && Send(2)
 SetTimer go, Random(-1000, -10000)
}

Return to “Gaming Help (v2)”

Who is online

Users browsing this forum: No registered users and 22 guests