[按键精灵] 纯文本查看 复制代码
Dim MapVal(9, 11), MapX1(9, 11), MapY1(9, 11), MapX2(9, 11), MapY2(9, 11),Pic(0)
Dim DisX,DisY,StartX,StartY
Dim i,j,intX,intY,ImgID,s
Dim ClickXY,result,ijArr
DisX = (866 - 209) / 6
DisY = (1632 - 756) / 8
StartX = Round(209 - 2 * DisX)
StartY = Round(756 - 2 * DisY)
Pic(0)="Attachment:1.png|Attachment:2.png|Attachment:3.png|Attachment:4.png|Attachment:5.png|Attachment:6.png|Attachment:7.png|Attachment:8.png|Attachment:9.png|Attachment:10.png|Attachment:11.png|Attachment:12.png|Attachment:13.png|Attachment:14.png|Attachment:15.png|Attachment:16.png|Attachment:17.png|Attachment:18.png|Attachment:19.png|Attachment:20.png|Attachment:21.png|Attachment:22.png|Attachment:23.png|Attachment:24.png|Attachment:25.png"
For j = 0 To 11
For i = 0 To 9
MapX1(i, j) = Round(StartX + DisX * i)
MapY1(i, j) = Round(StartY + DisY * j)
MapX2(i, j) = Round(StartX + DisX * (i + 1))
MapY2(i, j) = Round(StartY + DisY * (j + 1))
MapVal(i, j) = ""
TracePrint i, j,MapX1(i, j),MapY1(i, j),MapX2(i, j),MapY2(i, j)
Next
Next
Do
KeepCapture
For j = 0 To 11
For i = 0 To 9
MapVal(i, j)=FindPic(MapX1(i, j),MapY1(i, j),MapX2(i, j),MapY2(i, j), Pic(0), "303030", 1, 0.7, intX, intY)
If MapVal(i, j) = -1 Then
MapVal(i, j) = "X"
Else
ClickXY = Check(i, j, MapVal(i, j))
result = Split(ClickXY, "|")
If result(0) = "1" Then
ijArr = Split(result(1),",")
Tap MapX1(i, j) + 50, MapY1(i, j) + 50
Tap MapX1(CInt(ijArr(0)), CInt(ijArr(1))) + 50, MapY1(CInt(ijArr(0)), CInt(ijArr(1))) + 50
MapVal(i, j) = "X"
MapVal(CInt(ijArr(0)), CInt(ijArr(1))) = "X"
End If
End If
Next
Next
ReleaseCapture
loop
Function Check(i, j, val)
Dim t1,tArr1,xy1,index1,xyArr1,t2,tArr2,index2,xy2,t3,tArr3
Check ="0"
t1 = getHeng(i, j, val)'第一次水平方向查找
tArr1 = Split(t1, "|")
If tArr1(0) = "1" Then
Check = t1 '第一次水平方向有结果了
Exit Function
ElseIf tArr1(0) = "0" Then
index1 = 0
For Each xy1 In tArr1
If index1 > 0 Then '从第二个元素开始,第一个是元素结果,非坐标
xyArr1 = Split(xy1, ",")
t2=getSu(Cint(xyArr1(0)),Cint(xyArr1(1)),val)'第二次垂直方向查找
tArr2 = Split(t2, "|")
If tArr2(0) = "1" Then
Check = t2 '第二次垂直向有结果了
Exit Function
ElseIf tArr2(0) = "0" Then
index2 = 0
For Each xy2 In tArr2
If index2 > 0 Then
xyArr2 = Split(xy2, ",")
t3=getHeng(Cint(xyArr2(0)),Cint(xyArr2(1)),val)'第三次水平方向查找
tArr3 = Split(t3, "|")
If tArr3(0) = "1" Then
Check =t3'第三次水平方向有结果了
Exit Function
End If
End If
index2 = index2 + 1
Next
End If
End If
index1 = index1 + 1
Next
End If
t1 = getSu(i, j, val)'第一次垂直方向查找
tArr1 = Split(t1, "|")
If tArr1(0) = "1" Then
Check = t1 '第一次垂直方向有结果了
Exit Function
ElseIf tArr1(0) = "0" Then
index1 = 0
For Each xy1 In tArr1
If index1 > 0 Then '从第二个元素开始,第一个是元素结果,非坐标
xyArr1 = Split(xy1, ",")
t2=getHeng(Cint(xyArr1(0)),Cint(xyArr1(1)),val)'第二次水平方向查找
tArr2 = Split(t2, "|")
If tArr2(0) = "1" Then
Check = t2 '第二次水平向有结果了
Exit Function
ElseIf tArr2(0) = "0" Then
index2 = 0
For Each xy2 In tArr2
If index2 > 0 Then
xyArr2 = Split(xy2, ",")
t3=getSu(Cint(xyArr2(0)),Cint(xyArr2(1)),val)'第三次垂直方向查找
tArr3 = Split(t3, "|")
If tArr3(0) = "1" Then
Check =t3'第三次垂直方向有结果了
Exit Function
End If
End If
index2 = index2 + 1
Next
End If
End If
index1 = index1 + 1
Next
End If
End Function
Function getHeng(i, j, val)
Dim s1,ss1,s2,ss2
s1 = getLeft(i, j, val)
ss1 = Split(s1, "|")
If ss1(0) = "1" Then
getHeng = s1
Exit Function
End If
s2=getRight(i, j, val)
ss2 = Split(s2, "|")
If ss2(0) = "1" Then
getHeng = s2
Exit Function
End If
If ss1(0) = "-1" Then
getHeng = s2
Else
If ss2(0) = "-1" Then
getHeng = s1
Else
getHeng = s1 & Right(s2, Len(s2) - 1)
End If
End If
End Function
Function getSu(i, j, val)
Dim s1,ss1,s2,ss2
s1 = getUp(i, j, val)
ss1 = Split(s1, "|")
If ss1(0) = "1" Then
getSu = s1
Exit Function
End If
s2=getDown(i, j, val)
ss2 = Split(s2, "|")
If ss2(0) = "1" Then
getSu = s2
Exit Function
End If
If ss1(0) = "-1" Then
getSu = s2
Else
If ss2(0) = "-1" Then
getSu = s1
Else
getSu = s1 & Right(s2, Len(s2) - 1)
End If
End If
End Function
Function getLeft(ii, j, val)
Dim i,s
s = "-1"
For i = ii - 1 To 0 step - 1
If MapVal(i, j) = "X" Then
If s = "-1" Then
s="0|" & i & "," & j
Else
s = s & "|" & i & "," & j
End If
Else
If MapVal(i, j) = val Then
s = "1|" & i & "," & j
End If
Exit For
End If
Next
getLeft = s
End Function
Function getRight(ii, j, val)
Dim i,s
s = "-1"
For i = ii + 1 To 9
If MapVal(i, j) = "X" Then
If s = "-1" Then
s="0|" & i & "," & j
Else
s = s & "|" & i & "," & j
End If
Else
If MapVal(i, j) = val Then
s = "1|" & i & "," & j
End If
Exit For
End If
Next
getRight = s
End Function
Function getUp(i, jj, val)
// Dim i,s
s = "-1"
For j = jj - 1 To 0 step - 1
If MapVal(i, j) = "X" Then
If s = "-1" Then
s="0|" & i & "," & j
Else
s = s & "|" & i & "," & j
End If
Else
If MapVal(i, j) = val Then
s = "1|" & i & "," & j
End If
Exit For
End If
Next
getUp = s
End Function
Function getDown(i, jj, val)
// Dim i,s
s = "-1"
For j = jj + 1 To 11
If MapVal(i, j) = "X" Then
If s = "-1" Then
s="0|" & i & "," & j
Else
s = s & "|" & i & "," & j
End If
Else
If MapVal(i, j) = val Then
s = "1|" & i & "," & j
End If
Exit For
End If
Next
getDown = s
End Function