send loop until i release

Get help with using AutoHotkey and its commands and hotkeys
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

send loop until i release

24 Apr 2017, 11:54

hi buddys,

i need to make a macro

when i press F1 and hold it down

it does

send 1
sleep 1000
send 2
sleep 1000
send 3
sleep 1000



it should be in a loop

but when i relase after 2seconds for example it should not send the 3
when i relase after 1 second it should not send the 2

you know what i mean, releasing F1 should interrupt the macro and when i push F1 again it should start from the beginning again as long as i hold it.
Rohwedder
Posts: 3504
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: send loop until i release

24 Apr 2017, 14:28

Hallo,
within the loop before each send:

Code: Select all

If !GetKeyState("F1" , "P")
		Break
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: send loop until i release

24 Apr 2017, 15:10

can someone make a example code? i dont understand the break
Rohwedder
Posts: 3504
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: send loop until i release

24 Apr 2017, 23:36

Hallo,
example code with the first Send

Code: Select all

F1::
	Loop
	{
		If !GetKeyState("F1" , "P")
			Break
		send 1
		sleep 1000
	}
Return
pendex4k
Posts: 2
Joined: 12 Oct 2020, 10:52

Re: send loop until i release

13 Oct 2020, 09:42

Hi, could you help me making a script that

Starts with F12

presses 5
presses "enter"

And then it loops until i hit x

If you could help me it will be much appreciate it.
Rohwedder
Posts: 3504
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: send loop until i release

13 Oct 2020, 09:55

Try:

Code: Select all

F12::SetTimer, TF12, 200 ;every 200ms
x::SetTimer, TF12, Off
TF12:
SendInput, 5
Sleep, 50
SendInput, {Enter}
Return

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, c7aesa7r, dazsmith99, Google [Bot], mikeyww, songdg and 61 guests