按键安卓脚本模块

Sub 卡死判断(x1, y1, x2, y2, t,点位数量)     Dim kasi     Do         Delay 1000         TracePrint "启动脚本"         If kasi =1 Then             ////向移动配置项立即写入一个数据8             TracePrint "卡死成立"             WriteConfig "卡死", 1, true             Delay 3000             ReadConfig "卡死", 0             TracePrint "卡死"             Delay 2000             kasi = 0             Exit Do          Else             WriteConfig "卡死", 0, true             Delay 3000             ReadConfig "卡死", 0             Delay 10*1000         End If         Delay 1000         KeepCapture         Dim  单步 = 0         Dim xArr(),yArr()         Dim colorGet1()         Dim j         For i = Abs(x2 - x1) / 点位数量+x1 To x2 Step Abs(x2 - x1) / 点位数量             j = Abs(y2 - y1) / 点位数量 * 单步 + y1             colorGet1(单步) = GetPixelColor(i,j)             单步 = 单步 + 1         Next         TracePrint 单步         ReleaseCapture         TracePrint join(colorGet1,",")         Delay t * 1000         Dim colorGet2()         单步=0         For i = Abs(x2 - x1) / 点位数量 +x1 To x2 Step Abs(x2 - x1) / 点位数量             j = Abs(y2 - y1) / 点位数量 * 单步 + y1             colorGet2(单步) = GetPixelColor(i,j)             If colorGet1(单步) <> colorGet2(单步) Then                 kasi = 0                 TracePrint "未卡死"                 Exit For             End If             单步 = 单步 + 1             Delay 1000         Next         TracePrint join(colorGet2,",")         If 单步 = 点位数量 Then             kasi = 1             TracePrint "卡死"         End If         Delay 60 * 1000 * 10     Loop End Sub Sub 脚本期限(使用期限)     '====================使用期限====================     ////////////////////////////////////////////////     Dim 脚本     Dim 年,月,日     日= DateTime.Day()     月= DateTime.Month()     年 = DateTime.Year()     TracePrint 年,月,日     TracePrint join(使用期限,",")     If 使用期限(0) < 年 Then         脚本= True     ElseIf 使用期限(0) = 年 Then         If 使用期限(1) > 月 Then             脚本 = false         ElseIf 使用期限(1) = 月 Then             If 使用期限(2) >= 日 Then                 脚本 = false             Else                 脚本= True             End If         Else             脚本= True         End If     Else         脚本 = false     End If     If 脚本 = True Then         TracePrint "脚本到期,请联系作者"         Sys.SetClipText "903498607"         For 2             ShowMessage "脚本到期,请联系作者QQ:903498607,粘贴即可搜索"             Delay 3000         Next         EndScript     Else         TracePrint "脚本到期时间" & Join(使用期限, ",")       End If End Sub Dim 返回值 Call 脚本中控() Sub 脚本中控()     If 获取网页源码指定内容("http://www.cnblogs.com/895200035qq/articles/5906587.html", "有效")>0 Then         TracePrint "脚本可用"     Else         TracePrint "脚本不可用"         ShowMessage "脚本更新,联系作者QQ903498607"         Delay 3000         EndScript     End If     dim 日期     日期 = InStr(1, 返回值, "日期:", 1)     TracePrint 日期     Dim 期限arr     期限arr = Mid(返回值, 日期+7, 10)     TracePrint 期限arr     Dim 使用期限     使用期限 = Split(期限arr, "-")     TracePrint Join (使用期限,",")     TracePrint clng(使用期限(0))     Call 脚本期限(使用期限) End Sub Function 获取网页源码指定内容(网址, 内容)     返回值 = URL.Get(网址)     TracePrint 返回值     获取网页源码指定内容 = InStr(1, 返回值, 内容, 1) End Function Sub 脚本期限(使用期限)     '====================使用期限====================     ////////////////////////////////////////////////     Dim 脚本     Dim 年,月,日     日= DateTime.Day()     月= DateTime.Month()     年 = DateTime.Year()     TracePrint 年,月,日     TracePrint join(使用期限,",")     If clng(使用期限(0)) < 年 Then         脚本= True     ElseIf clng(使用期限(0)) = 年 Then         If clng(使用期限(1)) > 月 Then             脚本 = false         ElseIf clng(使用期限(1)) = 月 Then             If clng(使用期限(2)) >= 日 Then                 脚本 = false             Else                 脚本= True             End If         Else             脚本= True         End If     Else         脚本 = false     End If     If 脚本 = True Then         TracePrint "脚本到期,请联系作者"         Sys.SetClipText "903498607"         For 2             ShowMessage "脚本到期,请联系作者QQ:903498607,粘贴即可搜索"             Delay 3000         Next         EndScript     Else         TracePrint "脚本到期时间" & Join(使用期限, ",")         //        Thread.Start (线程1,使用期限)     End If End Sub Function 找图(图片)     FindPic 0, 0, 0, 0, "Attachment:" & 图片 & ".png", 000000, 0, 0.0, intx, inty     If intx > -1 Then         找图 = True         Else 找图=False     End If End Function Function 多点找色(特征组)     FindMultiColor x1,y1,x2,y2,特征组(0),特征组(1),0,0.9,intx,inty     If intx > -1 Then         多点找色 = True     Else         多点找色 = False     End If End Function Function 修改网页内容(登录网址, 账号, 密码, 内容)     Dim post数据     post数据 = "username=" & 账号 & "&password=" & _     密码 &"&question=0&answer=&templateid=0&expires=43200"     Dim 返回值     返回值 = URL.Post(登录网址, post数据) End Function Function 获取网页源码指定内容(网址, 内容)     Dim 返回值     返回值 = URL.Get("网址")     获取网页源码指定内容 = InStr(1, 返回值, 内容, 1) End Function Function 修改网页内容(登录网址, 账号, 密码, 内容)     Dim post数据     post数据 = "username=" & 账号 & "&password=" & _     密码 &"&question=0&answer=&templateid=0&expires=43200"     Dim 返回值     返回值 = URL.Post("https://passport.cnblogs.com/user/signin?ReturnUrl=http%3A%2F%2Fwww.cnblogs.com%2F", post数据)     TracePrint 返回值     If InStr(1, 返回值, "登陆成功", 1) > 0 Then         TracePrint "登陆成功"     Else         TracePrint "登录失败"     End If End Function Dim 图片组arr1=Array ("图1","图2","图3","图4","图5")'不重复查找 Dim 图片组arr2=Array ("图1","图2","图3","图4","图5")'可重复查找 Dim 图片合集arr1(),图片合集arr2(),图片合集1,图片合集2 Call 图片整合(图片组arr1, 0, 0, 图片合集arr1) Call 图片整合(图片组arr2, 0, 0, 图片合集arr2) ////////////////////////////////////////////////////////////////////////////////// '参数1:图片组为一维数组 ///////////////////////////////////////////////////////////////////////////////// '参数2:路径为0则为附件路径,不为0时请填写真实路径 ////////////////////////////////////////////////////////////////////////////////// '图片格式为0则为png格式,为1则为bmp格式 ////////////////////////////////////////////////////////////////////////////////// '以下三个函数需相互配合使用 Function 图片整合(图片组, 路径, 图片格式, 图片合集arr)     Dim Img_Str     If 路径 = 0 or 路径 = null Then         路径="Attachment:"     End If     If 图片格式 = 0  or 图片格式=null  Then         图片格式 = ".png"     ElseIf 图片格式 = 1 Then         图片格式 = ".bmp"     End If     For i = 0 To UBOUND(图片组)         Img_Str = Img_Str & 路径 & 图片组(i) & 图片格式 & "|"         图片合集arr(i) = 路径 & 图片组(i) & 图片格式 & "|"     Next     TracePrint Img_Str     图片合集1=Img_Str     TracePrint Join (图片合集arr,",") End Function Sub 找多图(图片合集1,图片合集2)     If 找多图(图片合集1) > -1 Then '不重复查找图片组         图片合集1 = Replace(图片合集1, 图片arr(imgID), "", false)         '执行操作     ElseIf 找多图(图片合集2) > -1 Then'可重复查找图片组         '执行操作     End If End Sub Function FindPicEx(图片组)     FindPicEx = FindPic(0, 0, 0, 0, 图片组, 000000, 0, 0.9, intx, inty) End Function '####################################以下井号内的内容需要设为全局(放在代码最顶端) Import "ruokuai.lua"  //必须加载 Dim RKHOST="10.0.2.2:81"  //必须声明 '####################################以上井号内的内容需要设为全局(放在代码最顶端) '*********************************以下这是一个使用例子*********************************** //查询用户名 Dim Reply = "" Reply = RkInfo("q41551520","mima1120") TracePrint " 服务器返回:" & Reply //截图(测试的时候自己用抓抓选择区域,坐标为左上角与右下角) SnapShot "/sdcard/test.png",258,81,433,157 //区域截图 TracePrint "截图完成"

//把上传验证码  Reply = RkCreate("q41551520","mima1120","3040", "60", "67627", "62e9d7f2ac244d378dbe017ff0d70a91","/sdcard/test.png")//用户名,密码,验证码类型,超时时间,软件ID,软件Key,文件路径 TracePrint " 服务器返回:" & Reply   //服务器返回结果是JSON或者XML格式, 需要解析 Dim result Dim id if (UTF8.InStr(1,Reply, "Error") = 0) then  result = UTF8.Mid(Reply,UTF8.InStr(1,Reply, "Result")+9,UTF8.InStr(1,Reply, "Id")-UTF8.InStr(1,Reply, "Result")-12)  TracePrint result    id = UTF8.Mid(Reply,UTF8.InStr(1,Reply, "Id")+5,UTF8.InStr(1,Reply, "}")-UTF8.InStr(1,Reply, "Id")-6)  TracePrint id  Else                                      Dim err  err = UTF8.Mid(Reply,UTF8.InStr(1,Reply, "Error")+8,UTF8.InStr(1,Reply, "Error_Code")-UTF8.InStr(1,Reply, "Error")-11)  TracePrint err End If //如果验证识别错误报错,其中的ID是 //Reply = RkReport("用户名","密码", "1", "b40ffbee5c1cf4e38028c197eb2fc751",id) //TracePrint " 服务器返回:" & Reply '*********************************以上这是一个使用例子*********************************** '*********************************以下为若快封装好的代码(建议放在代码最后面)*********************************** Function RkCreate(UserName, Password, Typeid,TimeOut, Softid, Softkey, FilePath)  Dim re  Dim data     data = "username=" & UserName  data = data & "&password=" & Password  data = data & "&typeid=" & Typeid  data = data & "&timeout=" & TimeOut  data = data & "&softid=" & Softid  data = data & "&softkey=" & Softkey  Dim base=ruokuai.ReadFileBase(FilePath)  data = data & "&Img=" & replace(base,"+","%2b")  re = URL.Post("http://" & RKHOST & "/create.json", data, 60)  if re = null then re = ""  if instr(1,re , "<") <> 0 then re = "#网络错误"  RkCreate = re End Function Function RkReport(UserName,Password,Softid,Softkey,Id)  Dim re  Dim data     data = "username=" & UserName  data = data & "&password=" & Password  data = data & "&softid=" & Softid  data = data & "&softkey=" & Softkey  data = data & "&id=" & Id  re = URL.Post("http://" & RKHOST & "/reporterror.json", data, 20)  if re = null then re = ""  if instr(1,re , "<") <> 0 then re = "#网络错误"  RkReport = re End Function Function RkInfo(UserName, Password)  Dim re  re = URL.Post("http://" & RKHOST & "/info.json", "username=" & UserName &"&password=" & Password, 20)  if re = null then re = ""  if instr(1,re , "<") <> 0 then re = "#网络错误"  RkInfo = re End Function //*********************************以上为若快封装好的代码(建议放在代码最后面)*********************************** Sub 联众打码()  Import "lzdm.lua" '-------------------------------- 定义数据 ---------------------------------------- Dim ts = time() Dim user = "xgg_1311"       '用户名 Dim pwd = "guo122304"       '密码 Dim softID = "5386"       '软件ID Dim software = "联众打码2.0"    '接入联众答题的软件版本号 Dim sdk = "Android-lua1.3.1"   '接口版本号 Dim Secret = "80H6ffBzupQDPiOcrloZPwYOkdBpb4IuNGvaTpDQ"       '安全码,在开发者后台-安全中心获取 Dim filepath = "/sdcard/test.png"      '图片路径 Dim captchaType = 0      '验证码类型 Dim minlen = 4       '验证码最短长度(可选) Dim maxlen = 4       '验证码最大长度(可选) '-------------------------------- 测试范例 ---------------------------------------- SnapShot "/sdcard/test.png",95,422,354,495//区域截图 dim ret, captchaId

//发送验证码 ret = lzdm.lz_SendVerCode(ts, softID, software, sdk, Secret, user, pwd, filepath, captchaType, minlen, maxlen) If ret <> "" Then     captchaId = ret     TracePrint "验证码ID是: " & captchaId Else     TracePrint "验证码发送失败,错误原因: " & lzdm.LassError() End If

//获取验证码结果 ret = lzdm.lz_GetVerCode(ts, softID, software, sdk, Secret, user, pwd, captchaId) If ret <> "" Then     TracePrint "验证码识别结果: " & ret Else     TracePrint "验证码结果获取失败,错误原因: " & lzdm.LassError() End If

//一键打码 ret = lzdm.lz_RecYZM_A(ts, softID, software, sdk, Secret, user, pwd, filepath, captchaType, minlen, maxlen) If ret <> "" Then     TracePrint "验证码识别结果: " & ret Else     TracePrint "验证码结果获取失败,错误原因: " & lzdm.LassError() End If

//获取用户余额 ret = lzdm.lz_GetUserInfo(ts, softID, software, sdk, secret, user, pwd) If ret <> "" Then     TracePrint "当前账户余额为: " & ret Else     TracePrint "获取余额失败,错误原因: " & lzdm.LassError() End If

//验证码报错 ret = lzdm.lz_ReportError(ts, softID, software, sdk, secret, user, pwd, captchaId) If ret Then     TracePrint "验证码报错成功" Else     TracePrint "报错失败,错误原因: " & lzdm.LassError() End If

End Sub

posted on 2016-09-26 00:21  1311-小桂哥  阅读(577)  评论(0)    收藏  举报