help me with repeat until errorlevel 0

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
frizzovoi
Posts: 1
Joined: 10 Jun 2023, 10:08

help me with repeat until errorlevel 0

Post by frizzovoi » 10 Jun 2023, 10:19

I need my script to run again after ErrorLevel 0.

Code: Select all

F8::suspend
F6::pause
*~$F7::
CoordMode, Pixel, Screen
SendMode Input
{
Sleep, 0025
Send, {LButton Down}
Sleep, 1000
Send, {LButton Up}
Sleep, 2500
	{
	PixelGetColor, cz, 900, 760
	PixelSearch, px, py, 920, 750, 920, 750, %cz%, 1, Fast
	while(ErrorLevel != 0)
		{
		Sleep, 0050
		Send {LButton}
		Sleep, 0030
		}
	}
}
return

User avatar
boiler
Posts: 17070
Joined: 21 Dec 2014, 02:44

Re: help me with repeat until errorlevel 0

Post by boiler » 10 Jun 2023, 10:39

You need you PixelSearch command inside the loop or else it never runs again so ErrorLevel changes. Or else you keep checking the result of the same search.

Post Reply

Return to “Ask for Help (v1)”