【问题标题】:AHK Pixelgetcolor changing coordinates inside a loopAHK Pixelgetcolor 在循环内改变坐标
【发布时间】:2016-02-07 06:41:27
【问题描述】:

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

如果 (StaticColor = ColorInCoordinate) {

运行这个

}

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

【问题讨论】:

  • 你的意思是PixelGetColor?运行 8 次有什么问题?

标签: loops autohotkey


【解决方案1】:

使用数组:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 2018-12-24
    • 2016-06-02
    • 2018-01-12
    • 2011-02-19
    • 1970-01-01
    • 2013-09-13
    相关资源
    最近更新 更多