Autohotkey 我的ahk代码不工作

Autohotkey 我的ahk代码不工作,autohotkey,Autohotkey,当我按F2键时,它应该在区域中搜索0xFFEB63。如果没有颜色,则单击1136642。至少,这是我想要做的。它直接跳转到其他部分。如果在指定区域中找到颜色,则ErrorLevel设置为0,如果没有找到颜色,则设置为1,或2,如果存在阻止命令执行搜索的问题。 编辑: 你应该使用 F2:: Loop, { PixelSearch, Px, Py, 432, 298, 444, 286, 0xFFEB63, 3, Fast if (errorlevel = 0) ; If col

当我按F2键时,它应该在区域中搜索0xFFEB63。如果没有颜色,则单击1136642。至少,这是我想要做的。它直接跳转到其他部分。

如果在指定区域中找到颜色,则ErrorLevel设置为0,如果没有找到颜色,则设置为1,或2,如果存在阻止命令执行搜索的问题。

编辑: 你应该使用

F2::
Loop,
{
    PixelSearch, Px, Py, 432, 298, 444, 286, 0xFFEB63, 3, Fast
    if (errorlevel = 0)  ; If color is found in the first area
    {
        Sleep 5000
        Click 1040,638
        Sleep 1500
        Click 1055,288
        Sleep 10000
    }
    else
    if (errorlevel = 1)  ; If color is not in the first area
    {
        sleep 3000
        Click 1136, 642
        sleep 10000
    }
    ; else   ; if (errorlevel = 2) 
    ; do sth else
}
return
在“自动执行”部分中,除非希望坐标相对于活动窗口

F2::
Loop,
{
    PixelSearch, Px, Py, 432, 298, 444, 286, 0xFFEB63, 3, Fast
    if (errorlevel = 0)  ; If color is found in the first area
    {
        Sleep 5000
        Click 1040,638
        Sleep 1500
        Click 1055,288
        Sleep 10000
    }
    else
    if (errorlevel = 1)  ; If color is not in the first area
    {
        sleep 3000
        Click 1136, 642
        sleep 10000
    }
    ; else   ; if (errorlevel = 2) 
    ; do sth else
}
return
CoordMode, Pixel, Screen