Simple spam script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Vaako

Simple spam script  Topic is solved

11 Mar 2018, 13:45

Hi, i have this simple script currently which spams "1" and is turned on/off with F2 :

Loop
{
Send 1
Sleep 230
}
return

F2::Pause

I would like the exact same script, but instead of spamming only 1 i want it to spam 2 and 3 also with adjustable spam rate. I want the keys to be spammed simulteniously, can you help me? Thanks.
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Simple spam script

12 Mar 2018, 02:19

Hallo.
try:

Code: Select all

SetTimer, 1, 230 ;every 230 ms
SetTimer, 2, 330 ;every 330 ms
SetTimer, 3, 430 ;every 430 ms
1:
2:
3:
	Send % A_ThisLabel
Return

F2::Pause
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: Simple spam script

12 Mar 2018, 03:25

or it could be done something like this

Code: Select all

^y:: :< set adjustable spam rate in ms
	defaultspamrate := 230
	inputbox,spamrate, Adjustable Spam Rate, What spam rate in ms?,,,,,,,,%defaultspamrate%
	if (errorlevel)
		spamrate := defaultspamrate
	return

f2::
running := !running
spamit:
	while (running)
	{	send 123
		sleep %spamrate%
	}
	return
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.
maereax
Posts: 1
Joined: 12 Mar 2018, 14:17

Re: Simple spam script

12 Mar 2018, 14:23

eventhorizon wrote:or it could be done something like this

Code: Select all

^y:: :< set adjustable spam rate in ms
	defaultspamrate := 230
	inputbox,spamrate, Adjustable Spam Rate, What spam rate in ms?,,,,,,,,%defaultspamrate%
	if (errorlevel)
		spamrate := defaultspamrate
	return

f2::
running := !running
spamit:
	while (running)
	{	send 123
		sleep %spamrate%
	}
	return
Hey bud, I'm not OP but i am a total noob to autohotkey and I'm trying to make something similar.
I want something to spam the number 4 every 6 seconds. I took what you made above and tried making this, but i'm getting an error

Code: Select all

^y:: :< set adjustable spam rate in ms
	defaultspamrate := 6000
	inputbox,spamrate, Adjustable Spam Rate, What spam rate in ms?,,,,,,,,%defaultspamrate%
	if (errorlevel)
		spamrate := defaultspamrate
	return

f2::
running := !running
spamit:
	while (running)
	{	send 4
		sleep %spamrate%
	}
	return
I have a .ahk file on the desktop that I'm right clicking and editing with that above code inside, and when I run it I get:

Error this line does not contain a recognized action.
Info: : < set adjustable spam rate in ms
Line#
001: Return
This program will now exit

Am i making a silly mistake or just doing this completely wrong?
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Simple spam script

13 Mar 2018, 01:20

Hallo,
I have corrected the Maereax script:

Code: Select all

spamrate := 230 ;defaultspamrate
^y:: ;< set adjustable spam rate in ms
inputbox,spamrate, Adjustable Spam Rate, What spam rate in ms?,,,,,,,,%spamrate%
if (errorlevel)
	spamrate := spamrate
return
#MaxThreadsPerHotkey, 2
f2::
#MaxThreadsPerHotkey, 1
running := !running
while (running)
{	
	send 123
	sleep %spamrate%
}
return
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: Simple spam script

19 Mar 2018, 16:05

The comment line in the ^y hotkey line (line 1) used a colon character (:) instead of a semi-color (;). My Bad. I didn't confirm the code. Change the colon (:) in that like to a semi-colon (;) and it should be fine.
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.
burl

Re: Simple spam script

25 Mar 2018, 18:48

hi,can u make this script run in background or in a minimized game?i tried this and it is working but only when the window im playing is active.thanks
User avatar
boiler
Posts: 16915
Joined: 21 Dec 2014, 02:44

Re: Simple spam script

08 Oct 2022, 04:42

@rendidii - That (your since deleted post) is not an accurate quote of Rohwedder’s post. If you meant to post your own modification of his code, please indicate that and don’t put your version inside quote tags.

Edit: Your version didn’t appear to have any serious value, so it has been (at least temporarily) deleted. If you can explain its purpose, which seems unlikely, it can be restored.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 67 guests