函数-规定时间内找图实例
If WaitImg("回收站", 1.5) Then
TracePrint "回收站找到了"
MoveTo ImgX, ImgY
Else
TracePrint"回收站没有被找到"
End If
Function WaitImg(图片名,找图时间)
Dim i
WaitImg = False
For i = 1 To 找图时间 * 10
FindPic 0, 0, 1024, 768, "Attachment:\" & 图片名 & ".bmp", 0.9, ImgX, ImgY
If ImgX > 0 Then
WaitImg = true
Exit For
End If
Delay 100
Next
TracePrint"共耗时"&(i/10)&"秒,寻找图片:"&图片名&"的找图结果为:x="&ImgX&",y="&ImgY
End Function
高级找图实例,可范围选择。。。。
If WaitImgEx(0,0,400,400,"回收站", 2) Then
TracePrint "回收站找到了"
MoveTo ImgX, ImgY
Else
TracePrint"回收站没有被找到"
End If
Function WaitImgEx(x1,x2,y1,y2,图片名,找图时间)
Dim i
WaitImgEx = False
For i = 1 To 找图时间 * 10
FindPic x1,x2,y1,y2, "Attachment:\" & 图片名 & ".bmp", 0.9, ImgX, ImgY
If ImgX > 0 Then
WaitImgEx = true
Exit For
End If
Delay 100
Next
TracePrint"共耗时"&(i/10)&"秒,寻找图片:"&图片名&"的找图结果为:x="&ImgX&",y="&ImgY
End Function
OK,大家比较一下,分析一下,欢迎交流。。。