0
votes

I need to write script like this:

if (PixelSearch && (other)PixelSearch == true)
{
// code
}

So I need to use Errorlevel, but how use Errorlevel with 2 different PixelSearch? Please help!

2

2 Answers

0
votes

I haven't worked with AutoIt code lately, but I would solve it like this:

;Find a pure red pixel in the range 0,0-20,300
$pixelSearchErrorOne = PixelSearch( 0, 0, 20, 300, 0xFF0000 );

; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$pixelSearchErrorTwo = PixelSearch( 0, 0, 20, 300, 0xFF0000, 10 );

if (Ubound($pixelSearchErrorOne) < 2 || Ubound($pixelSearchErrorOne) < 2)
{
// code
}

The 'Ubound' returns the count of an array, and when a PixelSearch succeeded, the variable should be filled with a 2-dimensional array with the coords :)

For more info on that, check: http://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm

I'm not sure if the double pipeline (||) is the OR statement in autoIt, but you can look that up.

0
votes

Just store the value of ErrorLevel to a variable immediately after your PixelSearch and then run your check on the variables.

PixelSearch, P1x, P1y, 200, 200, 300, 300, 0x9d6346, 3, Fast
Result1 := ErrorLevel

PixelSearch, P2x, P2y, 200, 200, 300, 300, 0xf0f0f0, 3, Fast
Result2 := ErrorLevel


If Result1 and Result2
    {
    // Code.
    }