AHK Pixelgetcolor改变循环内的坐标

时间:2016-02-07 06:41:28

标签: loops autohotkey

我需要帮助解决一些可能非常简单的逻辑问题而且我无法理解。我需要将屏幕中的不同坐标与变量上给出的静态值进行比较。像:

如果(StaticColor = ColorInCoordinate){

运行此

}

但我需要在不同坐标上运行8次以检查一切是否正常运行。除了在Ifs中运行GetPixelColor 8次之外还有其他更简单的方法吗?

1 个答案:

答案 0 :(得分:0)

使用数组:

StaticColor = 0x113322
coords := [ {x:122,y:112}
          , {x:464,y:589}
          , {x:163,y:673}
          , {x:173,y:457}
          , {x:245,y:986}
          , {x:264,y:567}
          , {x:252,y:922}
          , {x:556,y:773}]

Loop, % coords.MaxIndex() 
{
    currentX := coords[A_Index].x
    currentY := coords[A_Index].y
    PixelGetColor, ColorInCoordinate, currentX , currentY
    If (ColorInCoordinate = StaticColor) 
    {
        ;Run this
    }
}
相关问题