Page 1 of 1

send loop until i release

Posted: 24 Apr 2017, 11:54
by Aso
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.

Re: send loop until i release

Posted: 24 Apr 2017, 14:28
by Rohwedder
Hallo,
within the loop before each send:

Code: Select all

If !GetKeyState("F1" , "P")
		Break

Re: send loop until i release

Posted: 24 Apr 2017, 15:10
by Aso
can someone make a example code? i dont understand the break

Re: send loop until i release

Posted: 24 Apr 2017, 23:36
by Rohwedder
Hallo,
example code with the first Send

Code: Select all

F1::
	Loop
	{
		If !GetKeyState("F1" , "P")
			Break
		send 1
		sleep 1000
	}
Return

Re: send loop until i release

Posted: 13 Oct 2020, 09:42
by pendex4k
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.

Re: send loop until i release

Posted: 13 Oct 2020, 09:55
by Rohwedder
Try:

Code: Select all

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