Problems with "while A_TimeSinceThisHotkey"

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
GreenXp
Posts: 1
Joined: 12 Sep 2019, 18:22

Problems with "while A_TimeSinceThisHotkey"

12 Sep 2019, 18:34

Code: Select all

Numpad8::

while A_TimeSinceThisHotkey < 1000
	Send, w
	sleep, 1000
	
	
while A_TimeSinceThisHotkey < 1000
	Send, a
	sleep, 1000
I want this to work, basically make it hold w for a period of time then sleep then hold another key and so on, then I would like it on a loop.
I'm very retarded when it comes to scripts so the answer may be very simple, sorry :?
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Problems with "while A_TimeSinceThisHotkey"

13 Sep 2019, 01:23

Hallo,
try:

Code: Select all

Numpad8::
SetKeyDelay, 1000, 1000
;SetKeyDelay, Delay, PressDuration
Send, wa
Return
Or with AutoRepeat:

Code: Select all

Numpad8::
AutoRepeat("w", 1000)
Sleep, 1000
AutoRepeat("a", 1000)
Sleep, 1000
Return

AutoRepeat(Key, PressDuration)
{
    SetKeyDelay, 30
    Loop,% PressDuration//30
        Send, {%Key% Down}
    Send, {%Key% Up}
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ccqcl, Google [Bot], Rohwedder and 182 guests