How to make a key repeat it self every 2sec while spaming others? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
crimson4649
Posts: 18
Joined: 23 Jul 2017, 06:04

How to make a key repeat it self every 2sec while spaming others?

21 Nov 2019, 05:14

Sorry for the bad topic, but I couldn't find a better way to describe it :(

What I want is a script that does something like this:
~X::
Loop
{
if not GetKeyState("X", "P")
Break
Send {1}
sleep 20
Send {2}
sleep 20
Send {3 - Only every 2sec while X is held down, otherwise just skip}
sleep 20
}
Return


Is this something that can be done?

Thanks in advanced

//Best regards
Rohwedder
Posts: 7768
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to make a key repeat it self every 2sec while spaming others?  Topic is solved

21 Nov 2019, 08:27

Hallo,
try:

Code: Select all

~X::
3Send := A_TickCount + 2000
While, GetKeyState("X", "P")
{
	Send {1}
	sleep 20
	Send {2}
	sleep 20
	IF (A_TickCount > 3Send)
	{
		Send {3}
		3Send := A_TickCount + 2000
	}
	sleep 20
}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Kodakku, Noesis and 373 guests