Thank you all for your help, now it scans almost 150 images for 3 sec, and it is simple ImageSearch.
Here is the code is case someone got same problem.
Code: Select all
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
Numpad1::
CoordMode, mouse, Window
SetBatchLines, -1
DllCall("dwmapi\DwmEnableComposition", "uint", 0)
loop, 1
{
ImageSearch, xp, yp, 0, 0, 793, 726, *50 Fish.png
If ErrorLevel=0
{
MouseMove, xp, yp, 0
send {LButton}
}
ImageSearch, xp, yp, 0, 0, 793, 726, *50 Stone.png
If ErrorLevel=0
{
MouseMove, xp, yp, 0
send {LButton}
}
...
...
...
...
ImageSearch, xp, yp, 0, 0, 793, 726, *50 Wall.png
If ErrorLevel=0
{
MouseMove, xp, yp, 0
send {LButton}
}
}
Return
And another small question. I tried to write script using Gdip_ImageSearch function, but definetly made something wrong: it must make screenshot of active window, search image Needle.png within and click on it.
Gdip.ahk consist MasterFocus`s functions and placed in Autohotkey/Lib directory, so it works fine.
Can you please explain me whats wrong whit this code?
Code: Select all
#Include Gdip.ahk
Numpad1::
pToken := Gdip_Startup()
pBitmapHayStack := Gdip_BitmapFromScreen()
pBitmapNeedle := Gdip_CreateBitmapFromFile (Needle.png)
loop, 1
{
Gdip_ImageSearch(pBitmapHayStack, pBitmapNeedle, x, y)
if ErrorLevel=0
MouseClick, Right, x, y,
}
Gdip_DisposeImage(pBitmapNeedle)
Gdip_DisposeImage(pBitmapHayStack)
Gdip_Shutdown(pToken)
return