UNTIL with no matching LOOP

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bak989
Posts: 1
Joined: 24 Apr 2018, 18:46

UNTIL with no matching LOOP

24 Apr 2018, 18:52

I'm new to AHK. Basically what I'm trying to do is loop a function until it is completed then to move onto another loop until it is finshed and then loop the whole script again. As of now I get an error saying UNTIL with no matching LOOP.
Any help is appreciated.

Code: Select all

#MaxThreadsperHotkey 2
F8::
toggle := !toggle


loop
{
if toggle
{
Loop
Pixelsearch, px, py, 800, 462, 801, 463, 0xFEFF7A, 5, RGB
	if errorlevel
		MouseMove, 800, 462
	else
		MouseClick, left, 800, 462
Until errorlevel=1
}
{
Loop
Pixelsearch, px, py, 478, 12, 477, 11, 0xFFFFFE, 2, RGB
	if errorlevel
		MouseMove, 800, 462
	else
		MouseClick, left, 900,525
Until errorlevel=1
}
else
break
}
return
gregster
Posts: 9012
Joined: 30 Sep 2013, 06:48

Re: UNTIL with no matching LOOP

24 Apr 2018, 19:11

You are using the { } block syntax wrong - your second and third loops are just looping one single line each (the Pixelsearches)... the Untils are standing alone.
Compare https://autohotkey.com/docs/commands/Until.htm, https://autohotkey.com/docs/commands/Loop.htm and https://autohotkey.com/docs/commands/Block.htm

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ht55cd3, OrangeCat and 305 guests