Hello
Found ImageSearchAll example code viewtopic.php?p=391569#p391569
But it is for ahk v1, please help rewrite it for ahk v2. Thank you all in advance for your help
Alexei
Please help rewrite ImageSearchAl for ahk v2
Re: Please help rewrite ImageSearchAl for ahk v2
Try this:
Demo:
Here's a better reference for the v1 version: viewtopic.php?f=6&t=100838
Here is where the v2 version can now be found: viewtopic.php?f=83&t=118415
Code: Select all
ImageSearchAll(imageFile, x1:=0, y1:=0, x2:="Screen", y2:="Screen", var:=0) {
x2 := x2 = "Screen" ? A_ScreenWidth : x2
y2 := y2 = "Screen" ? A_ScreenHeight : y2
found := []
y := y1
loop {
x := x1
lastFoundY := 0
while f := ImageSearch( &foundX, &foundY, x, y, x2, y2, "*" var " " imageFile) {
if (lastFoundY = 0 || lastFoundY = foundY) {
found.Push(Map("x", foundx, "y", foundy))
x := foundX + 1
lastFoundY := foundY
} else
break
}
y := lastFoundY + 1
} until (x = x1) && !f
return found
}
Demo:
Code: Select all
#Requires AutoHotkey v2.0
#Include ImageSearchAll.ahk
Found := ImageSearchAll("mypic.png", 0, 0, 1000, 900)
for Each, Coord in Found
MsgBox Coord["x"] "," Coord["y"]
Here's a better reference for the v1 version: viewtopic.php?f=6&t=100838
Here is where the v2 version can now be found: viewtopic.php?f=83&t=118415
Re: Please help rewrite ImageSearchAl for ahk v2
hello boiler.
Many thanks for your help. The function works great.
Aleksei.
Many thanks for your help. The function works great.
Aleksei.