Initiating a loop from a different loop?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guest

Initiating a loop from a different loop?

19 Aug 2018, 03:58

would appreciate some help if anybody can chime in
trying to create a script where if I hold down the right mouse button for a set amount of time, it triggers a loop. and if the mouse button is released, the incremented value goes back to 0 so timer starts over again. Can't get the second loop to work at all, I'm sure it's a problem with the structure of the code, this is what I have so far, I'm missing the entire section for resetting the timer, that one I'm not even sure where to include yet.

timer := 0
loop
while GetKeyState("RButton")
{
timer += 1
sleep 100
}
return

loop
while timer > 3
{
run this loop when timer increments to 3 (300ms later)
}
return
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Initiating a loop from a different loop?

19 Aug 2018, 09:05

Hallo,
try:

Code: Select all

timer := 0
Loop
{
	Sleep, 100
	If GetKeyState("RButton")
	{
		timer += 1
	}
}
Until Timer = 3
loop
{
	;run this loop when timer increments to 3 (300ms later)
	ToolTip, % A_TickCount
}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 396 guests