tt = 查找屏幕图片(0, 0, 1920, 1080, "C:\Users\Administrator\Desktop\游戏\新建.bmp", 0.9)
If UBound(tt) > - 1 Then
TracePrint "共有"&UBound(tt)&"+1张图片"
For uu = 0 To UBound(tt)
Delay 1000
TracePrint "第"&uu&"张图的坐标为"&tt(uu)
Next
Else
TracePrint UBound(tt)
End If
Function 查找屏幕图片(左坐标,上坐标,右坐标,下坐标,图片路径,相似度)
//例子:MsgBox lib.图像.查找屏幕图片(0,0,800,300,"C:\图标.bmp",0.9)
//A1.B1.C1.D1 是为了便于设置找图的范围
Dim A1,B1,C1,D1,a,b,c,d,n,x,y,H
A1=左坐标
B1=上坐标
C1=右坐标
D1=下坐标
//(a.b.c.d)不要修改
a=A1: b=B1: c=C1: d=D1
//n是图片的数量
n = 0
Dim 数组(99)
Rem 循环搜索
Call FindPic(a,b,c,d,图片路径,相似度,x,y)
If (x>=0 and y>=0 and y=b and a=A1) Or (x>=0 and y>=0 and y=b and a<>A1) Or (x>=0 and y>=0 and a=A1 and y<>b) Then
数组(n) = x&","&y
TracePrint 数组(n)
n = n + 1 : H = y : a = x + 1 : b = y
Goto 循环搜索
ElseIf a>A1 Then
a = A1 : b = H + 1
Goto 循环搜索
End If
MyIndex = Filter(数组, ",")
查找屏幕图片 = MyIndex
End Function
If UBound(tt) > - 1 Then
TracePrint "共有"&UBound(tt)&"+1张图片"
For uu = 0 To UBound(tt)
Delay 1000
TracePrint "第"&uu&"张图的坐标为"&tt(uu)
Next
Else
TracePrint UBound(tt)
End If
Function 查找屏幕图片(左坐标,上坐标,右坐标,下坐标,图片路径,相似度)
//例子:MsgBox lib.图像.查找屏幕图片(0,0,800,300,"C:\图标.bmp",0.9)
//A1.B1.C1.D1 是为了便于设置找图的范围
Dim A1,B1,C1,D1,a,b,c,d,n,x,y,H
A1=左坐标
B1=上坐标
C1=右坐标
D1=下坐标
//(a.b.c.d)不要修改
a=A1: b=B1: c=C1: d=D1
//n是图片的数量
n = 0
Dim 数组(99)
Rem 循环搜索
Call FindPic(a,b,c,d,图片路径,相似度,x,y)
If (x>=0 and y>=0 and y=b and a=A1) Or (x>=0 and y>=0 and y=b and a<>A1) Or (x>=0 and y>=0 and a=A1 and y<>b) Then
数组(n) = x&","&y
TracePrint 数组(n)
n = n + 1 : H = y : a = x + 1 : b = y
Goto 循环搜索
ElseIf a>A1 Then
a = A1 : b = H + 1
Goto 循环搜索
End If
MyIndex = Filter(数组, ",")
查找屏幕图片 = MyIndex
End Function