I'm working on the project to the game to automate few processes, but to achieve this I have to loop the MouseMove to point on each foud object within the provided coords.
I'm using ImageSearchAll function - thanks to this guys (viewtopic.php?t=81672) and I have to go through the image like this:
and I have to point a mouse on every item which have only two vertical lines on it. The script finds only the first at the top and the last on the bottom, I need it to be more accurate).
Here is a code:
(My file image is 3.png, (13, 151, 403, 587) are the coords of my screen where a photo is and 30 is a tolerance (which is not working I think).)
Code: Select all
findtest(a)
{
FoundCoords := ImageSearchAll(a ".png", 13, 151, 403, 587, 30)
h:=0
for Each, Coord in FoundCoords
{
h:=h+1
MouseMove, Coord.x, Coord.y
Sleep 500
}
MsgBox, %h%
;TextOut .= Coord.x "," Coord.y "`n"
;MsgBox, % TextOut
return
}
PgUp::
findtest(3)
return
ImageSearchAll(imageFile, x1 := 0, y1 := 0, x2 := "Screen", y2 := "Screen", var := 0)
{
; found coordinates are returned as a simple array of coordinate pairs
; each coordinate pair is an associative array with keys "x" and "y"
x2 := x2 = "Screen" ? A_ScreenWidth : x2
y2 := y2 = "Screen" ? A_ScreenHeight : y2
found := []
y := y1
loop {
x := x1
loop {
ImageSearch, foundX, foundY, x, y, x2, y2, % "*" var " " imageFile
if (ErrorLevel = 2)
return -1
if !ErrorLevel {
found.Push({x: foundX, y: foundY})
x := foundX + 1
lastFoundY := foundY
}
} until ErrorLevel
Y := lastFoundY + 1
} until (x = x1) && ErrorLevel
return found
}
Maybe there is few pixels difference, but is it possible to build a function to recognize it?
It would be really great if someone finds time to solve this issue Thanks in advance.