How to make a toggle to spam a Num key?

Post your working scripts, libraries and tools for AHK v1.1 and older
Thelgow
Posts: 3
Joined: 03 Dec 2017, 09:11

How to make a toggle to spam a Num key?

03 Dec 2017, 09:20

Hello everyone,
It's been a while since I've used autohotkey so I remember somethings, but not all.
Typically I'd make a simple macro like ctrl+F1 and it would tab around a browser form and fill stuff out for me.

Currently I'm trying to make something like alt+q to toggle a spamming of Numpad1.

I looked at the definitive autofire thread and must have something wrong,
The AHK help said the keyboard key should be Numpad1.

toggle = 0
#MaxThreadsPerHotkey 2

!q::
Toggle := !Toggle
While Toggle{
Click
Send Numpad1
sleep 100
}
return


When I press this in notepad it is typing out Numpad1. And oddly deletes it and types it again.
This is going to be used in a game where I have a skill on Num1 and want to spam the hell out of it because I was doing it manually last night and have crazy hand pain.

Edit: Ahh, got it, {Numpad1}. However is it normal for it to keep deleting it as well? Its a bit weird.
When I hit alt+q, it sends a single 1, then it sends another and that deletes. So I basically just see 1, 11, 1, 11, 1... I would expect it just fill in a stream of 1's.
Also how do I start incorporating features like to only do when its the active window? Diablo3 is the game in particular.
User avatar
rommmcek
Posts: 1478
Joined: 15 Aug 2014, 15:18

Re: How to make a toggle to spam a Num key?

06 Dec 2017, 04:25

To test in Notepad increase the sleep to 700 ms, otherwise Notepad will detect double click and mark the last word in the line or the word under the mouse cursor if any, you're script overwrites that marked word...
For last Q use before HotKey

Code: Select all

#IfWinActive, Diablo3
P.s.: I think, this is a wrong forum for such a question!

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: jollyjoe and 114 guests