Тема: AHK:ImageSearch или как найти картинку в активном окне.
Здравствуйте есть код AHK испытываю такую проблему что бот не находит картинку вот сам код.
CoordMode, Pixel , Relative
Process, Priority,, H
SetDefaultMouseSpeed, 0
SetMouseDelay, -1
Gui +hwndhGui2 -Caption +ToolWindow +AlwaysOnTop
Gui, Add, Button, x12 y9 w100 h30 gDoor , Дверь/Багажник
Gui, Add, Button, x12 y89 w100 h30 gReload , Перезагрузка
Gui, Add, Button, x12 y49 w100 h30 gTrans , Трансопдер
Gui, Color, C1C1C1
return
F3::
ExitApp
F10::
l := 0
if i := !i
Gui Show, % "x" A_ScreenWidth - 200 " y" A_ScreenHeight - 200 " h" 125 " hide"
DllCall("AnimateWindow", Ptr, hGui2, UInt, 400, UInt, 0x40000|(i ? 1 : 0x10002))
return
Door:
Gui, Color, 17A33C
Loop{
if (l = 1)
{
PixelSearch, brokex1, brokey1, 950, 505, 955, 510, 0xFFFFFF , 30, Fast
if (brokex1 < 0)
{
PixelSearch, greenx1, greeny1, 950, 505, 955, 510, 0x17A33C , 130, Fast
if (greenx1 > 0)
{
Reload
}
else
{
Send {Esc}
Send {Esc}
sleep 200
Reload
}
}
brokex1 = 0
}
ImageSearch, xp, yp, 893, 478, 1019, 597, *155 point.png
if( xp > 0 )
{
l := 1
MouseMove, xp+20, yp+20
Loop{
if (brokex1 < 0)
{
PixelSearch, greenx1, greeny1, 950, 505, 955, 510, 0x17A33C , 130, Fast
if (greenx1 > 0)
{
Reload
}
else
{
Send {Esc}
Send {Esc}
sleep 200
Reload
}
}
brokex1 = 0
PixelSearch, ringx1, ringy1, xp+7, yp+7, xp+13, yp+13,
, 170, Fast
if( ringx1 > 0 )
{
Send {Click}
SoundPlay, %A_WinDir%\Media\Speech On.wav
Goto, Door
}
}
}
}
return
Reload:
Reload
return
Trans:
Gui, Color, 17A33C
sleep 300
Loop
{
PixelSearch, ptx, pty, 844, 412, 1076, 414, 0x6877FB , 68, Fast
if( ptx > 0 )
{
Send {Enter}
sleep 500
}
}
return