Taumantis, Welcome the the AutoIt forum. The problem you have is that the Until @error will never fire as @error at that point has been set to 0 by the preceding MouseClick line: HotKeySet("^!x", "MyExit")
Func MyExit()
Exit
EndFunc ;==>MyExit
Opt("MouseCoordMode", 1)
Do
Sleep(100)
MouseMove(1097, 760)
MouseClick("left")
Sleep(100)
Do
$i = PixelGetColor(1015, 760)
Sleep(10) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<< Important to reduce the load on the CPU
Until $i = 10846764
MouseClick("left")
Until @error ; <<<<<<<<<< But error at this point is set by the MouseClick and so will always be 0What error do you want to act as the trigger for leaving the loop? M23 Edit: Just seen your post. Why do you have 2 loops in that case? HotKeySet("^!x", "MyExit")
Func MyExit()
Exit
EndFunc ;==>MyExit
Opt("MouseCoordMode", 1)
While 1
Sleep(100)
MouseMove(1097, 760)
MouseClick("left")
Sleep(100)
If PixelGetColor(1015, 760) = 10846764 Then
ExitLoop ; This will take you to...
MouseClick("left")
WEnd
; ...here!Is that what you want?