0

我需要编写这样的脚本:

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

所以我需要使用 Errorlevel,但是如何使用 Errorlevel 和 2 个不同的 PixelSearch?请帮忙!

4

2 回答 2

0

我最近没有使用 AutoIt 代码,但我会这样解决它:

;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
}

'Ubound' 返回一个数组的计数,当 PixelSearch 成功时,变量应该用一个二维数组和坐标填充:)

有关这方面的更多信息,请查看:http ://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm

我不确定双管道 (||) 是否是 autoIt 中的 OR 语句,但你可以查一下。

于 2011-10-27T08:04:15.660 回答
0

只需ErrorLevel在 PixelSearch 之后立即将 的值存储到变量中,然后对变量进行检查。

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.
    }
于 2011-10-28T09:19:19.163 回答