通过图片找要操作的位置(加偏移量,屏幕范围可以用变量调整)
每扫过一行记得刷新一些变化的坐标信息 (记得坐标变化)
滚轮可以通过颜色的变化确定是否到底
如果直接确定不了要点击的图标(可以通过相对位置,找其附近的参照物)
为了防止要找的图片 被滑动没 ,多用静态的图标 (以静制动)
多次循环运行全局变量----不清零
图片要独一无二的
Dim status SCREEN_WIDTH = 2000 SCREEN_HEIGHT = 1500 URL = "这个地址是要请求自己数据抓取系统接口的" ADDRESS="E:\Program Files (x86)\Tencent\WeChat\WeChat.exe" Do //MessageBox status Delay 1500 Dim MyArray Enter =0 status=1 value=0 increment_Y=0 increment_X = 0 If status =1 Then //自动化脚本 FindPic 0,0,SCREEN_WIDTH,SCREEN_HEIGHT,"Attachment:\公众号准确.bmp",0.9,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+20, intY+20 LeftClick 1 Delay 500 End If color_value = "" Do If Enter = 0 Then Enter = 1 Else Delay 180 End If //Yes = 是否请求完成(URL) //TracePrint Yes If 0 <= increment_X <= 264 Then //MessageBox "小鱼5的过来" FindPic 0,0,SCREEN_WIDTH,SCREEN_HEIGHT,"Attachment:\首个位置定点.bmp",0.9,x,y If x > 0 And y > 0 Then SayString "" //MessageBox x &" "& y MoveTo x + 80 + increment_X, y + 100 + increment_Y LeftClick 1 Delay 500 FindPic 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, "Attachment:\历史--.bmp", 0.9, intX, intY TracePrint intX & " " & intY SayString "" If intX > 0 And intY > 0 Then SayString "" MoveTo intX - 190, intY - 250 MoveTo intX - 190, intY - 130 MoveTo intX - 30, intY - 250 MoveTo intX - 30, intY - 130 MoveTo intX + 10, intY + 10 LeftClick 1 Delay 500 FindPic 0,0,SCREEN_WIDTH,SCREEN_HEIGHT,"Attachment:\关闭参照物.bmp",0.9,intX,intY If intX > 0 And intY > 0 Then SayString "" Delay 500 MoveTo intX+20, intY-25 LeftClick 1 Delay 500 increment_X = increment_X + 66 End If Else range = 结束一轮(x, y) Delay 500 Exit Do End If End If ElseIf increment_X>264 Then increment_X = 0 increment_Y=increment_Y+104 Delay 500 value = value + 5 If value = 25 Then MoveTo x + 80 + increment_X - 50, y + 100 + increment_Y - 104 判断滚动条 (ADDRESS) Delay 500 End If //MessageBox a If color_value = "EFEFEF" and value=25 Then For 6 MouseWheel - 1 Delay 1000 Next value = 0 increment_Y = 0 ElseIf color_value = "CDCDCD" Then If value= 25 Then range = 结束一轮(x, y) Exit Do End If End If End If Loop End If Loop Function 判断滚动条(ADDRESS) Call RunApp(ADDRESS) Delay 1500 //下面这句是得到当前最前面的窗口句柄 M = Plugin.Window.Foreground() //下面这句是得到窗口句柄的类名 Class1 = Plugin.Window.GetClass(M) Delay 200 TracePrint "得到窗口句柄的类名为:"& Class1 //0表示忽略 //下面这句是查找窗口类名("Notepad")或者标题(0),返回找到的句柄Hwnd Hwnd = Plugin.Window.Find(Class1,0) //下面这句是得到窗口句柄的边框大小(包括标题栏) sRect = Plugin.Window.GetWindowRect(Hwnd) Delay 200 TracePrint "得到窗口句柄的边框大小(包括标题栏)为:"& sRect //下面这句用于分割字符串,将横坐标和纵坐标分成两个字符串 MyArray = Split(sRect, "|") //下面这句将字符串转换成数值 W1 = Clng(MyArray(0)): H1 = Clng(MyArray(1)) W2 = Clng(MyArray(2)): H2 = Clng(MyArray(3)) TracePrint "边框大小: " & W2 & " " & H2 //GetCursorPos x,y color_value = GetPixelColor(W2 - 7, H2 - 7) Delay 500 TracePrint color_value End Function Function 结束一轮(x,y) MoveTo x - 100, y + 100 Delay 500 LeftClick 1 Delay 3600000 status = 0 End Function Function 取网页源码(URL) Set objXML=CreateObject("Microsoft.XMLHTTP") objXML.Open "Get", URL, False objXML.setRestatusuestHeader "If-Modified-Since","0" objXML.send If objXML.readyState=4 then 取网页源码 =objXML.ResponseText End If objXML.Abort Set objXML = Nothing End Function Function 是否请求完成(URL) Do Delay 3000 Condition = 取网页源码(URL) TracePrint Condition If Condition = "0" Then Goto 结束 Else Delay 6000 End If Loop Rem 结束
完了觉得这篇文章对你有用你可以看下 按键精灵制作微信机器人脚本 这篇博文,相信对你也有用哈!