废话少说,直接上代码
Dim intX,intY
//调用到达函数
Call 到达()
//定义一个函数控制器
Function main()
End Function
//功能
Function 群发()
End Function
//点击在线
Function 点击在线()
Delay 500
KeepCapture //截图到内存
FindPic 16,209,395,730,"Attachment:在线1.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "找到在线图片了"
Tap intX,intY//点击当前位置坐标
Else
TracePrint "没找到"
End If
ReleaseCapture//释放内存
End Function
//点击发消息
Function 点击发消息()
Delay 500
KeepCapture //截图到内存
FindPic 0,0,0,0,"Attachment:发消息.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "找到发消息了"
Tap intX,intY//点击当前位置坐标
Else
TracePrint "没有找到发消息"
End If
ReleaseCapture//释放
End Function
//查找脚本运行是否成功到达聊天界面
Function 到达()
Delay 1000
Do//死循环,直到已成功到达聊天页,跳出循环
Delay 500
KeepCapture
FindPic 0,0,0,0,"Attachment:3kang.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "已到达"//如果以到达,跳出该循环,执行下一步操作
Call 发消息()
Exit Do//跳出循环体
Else
TracePrint "未到达"//如果未到达聊天页,重新调用点击在线,还有一种情况是,如果点击在线成功,点击发消息不成功,则重新调用发消息
Call 点击在线()
Delay 500
Call 点击发消息()
End If
ReleaseCapture
Loop
End Function
Function 发消息()
Do//死循环
Delay 500
KeepCapture
FindPic 0,0,0,0,"Attachment:img.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "找到img图片位置"
//为了避免点击失效发生,给for循环,每隔200毫秒点击一次,这样就大大降低了点击失败的概率
For 3
Delay 300
Tap intX,intY-40
Next
InputText "测试,勿回"
Delay 500
Call 发送()
Exit Do//跳出该循环
Else
TracePrint "没有找到img位置"
End If
ReleaseCapture
Loop
End Function
Function 发送()
Do
Delay 500
KeepCapture
FindPic 0,0,0,0,"Attachment:fasong2.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "找到了发送图片"
Tap intX, intY
//已经发完信息了,我们应该返回列表
Call 返回列表()
Exit Do//跳出循环
Else
TracePrint "未找到该图片"
End If
ReleaseCapture
Loop
End Function
Function 返回列表()
Delay 500
KeepCapture
FindPic 0,0,0,0,"Attachment:fanhui.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "找到返回按钮"
For 2
Tap intX,intY//点击
Next
Delay 500
Call 点击联系人()
Else
TracePrint "未找到"
End If
ReleaseCapture
End Function
//点击联系人
Function 点击联系人()
Do
Delay 500
KeepCapture
FindPic 0,0,0,0,"Attachment:lianxi.png","050505",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint intX
TracePrint intY
TracePrint "找到联系人了"
Tap intX, intY
Delay 1000
Swipe 176,355,174,227,600//延迟600毫秒
Call 到达()
Exit Do//跳出
Else
TracePrint "未找到联系人"
End If
ReleaseCapture
Loop
End Function
网友评论