If ErrorLevel = 1 for a certain time, do this?

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

If ErrorLevel = 1 for a certain time, do this?

05 Jun 2018, 00:34

F5::
{
Loop
{
Loop
{
Loop
{
PixelSearch, Px1, Py1, 620, 305, 1300, 775, 0x82D5D0, 3, Fast RGB
if ErrorLevel = 1
Loop
{
Tooltip, Searching for object 1
Break
}
Until ErrorLevel = 0
if ErrorLevel = 0
{
MouseClick, Px1, Py1
Click ; Object 1
Break
}
}
Until ErrorLevel = 0

Loop
{
PixelSearch, Px2, Py2, 0, 0, 1920, 1080, 0xFFFF8E, 3, Fast RGB
if ErrorLevel = 1
Loop
{
Tooltip, Searching for dropbox
Break
>>>*****"If ErrorLevel = 1 for 60 seconds then PixelSearch some other color"*****<<<
}
Until ErrorLevel = 0
if ErrorLevel = 0
{
MouseClick, Px2, Py2
Click ;
Break
}
}
Until Error Level = 0
Break
}
}
}

So this script is working perfectly for me! However I'd like to add a safeguard. If I cannot find a certain pixel for more than 60 seconds, I'd like to perform another command.
How would I add something that says "If ErrorLevel = 1 for more than 60 seconds then PixelSearch some other color"? The thing is that it's already in a loop :crazy:
brutus_skywalker
Posts: 175
Joined: 24 Dec 2016, 13:16
Location: Antarctica

Re: If ErrorLevel = 1 for a certain time, do this?

07 Jun 2018, 14:55

Code: Select all

timeCode := A_TickCount, thisErrorLevel := 0
While (A_TickCount - timeCode < 60000 AND thisErrorLevel){
PixelSearch, Px2, Py2, 0, 0, 1920, 1080, 0xFFFF8E, 3, Fast RGB
thisErrorLevel := ErrorLevel
}
Outsourcing Clicks & Presses Since 2004.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, teadrinker and 194 guests