以前写案件精灵的时候将常用到的一些功能写入了自己的命令库!现在不怎么玩,将代码给大家玩玩,都是一些很基础很基础的东西,小白可以看看~
Import shanhai.lua
Import jsdvip.lua
Import zm.luae
Function 取中间文本(原始文本, 特征前, 特征后)//取出中间文本
Dim qpos,hpos qpos=InStr(1, 原始文本, 特征前) hpos = InStr(qpos, 原始文本, 特征后) 取中间文本=Mid(原始文本,qpos+len(特征前),hpos-qpos-len(特征前))
End Function
Function 取所有中间文本(原始文本, 特征前, 特征后)
Dim ct,ct1,cd,ct2,wz
Do ct1 = 取中间文本(原始文本, 特征前, 特征后)
If ct1 = null Then
Exit Do
End If cd=Len(原始文本)
wz = InStr(1, 原始文本, 特征前&ct1&特征后)
ct2 = Right(原始文本,cd-wz)
原始文本 = ct2
ct = ct1&-&ct
Loop 取所有中间文本 = Split(ct,-)
End Function
Function 图灵机器人(userid,聊天内容)
Dim 请求地址=http://www.tuling123.com/api/product_exper/chat.jhtml Dim 请求数据 = info=&聊天内容&&userid=&userid&&_xsrf= dim 原始文本,特征前,特征后,qpos,hpos,消息
原始文本 = url.Post(请求地址,请求数据)
特征前 = /MsgType><Content><![CDATA[ 特征后 = ]]></Content></xml> qpos=InStr(1, 原始文本, 特征前)
hpos = InStr(qpos, 原始文本, 特征后)
消息 = Mid(原始文本, qpos + Len(特征前), hpos - qpos - Len(特征前))
Dim wz = InStr(1,消息,http)
If wz > 1 Then
消息 = Left(消息, wz-1)
End If Dim ggjj = InStr(1,消息,哥哥姐姐)
If ggjj >= 1 Then
消息 = Left(消息, ggjj-1)
End If Dim 关键句=特地回复 Dim 回复句 = 特地回复替换 Dim 指定回复 = Split(回复句,/)
If InStr(1, 消息, 机器人) >= 1 Then
消息 = 嗯嗯啊啊嗯嗯~ ElseIf InStr(1, 关键句, 消息) >= 1 Then 消息 = shanhai.RandArray(指定回复)
ElseIf InStr(1, 消息, 4岁) >= 1 Then 消息 = 嘿嘿嘿~女人的年龄是不能说的秘密哦~ ElseIf InStr(1, 消息, 小主人) >= 1 Then 消息 = 你你你~ End If 图灵机器人 = 消息
End Function
Function 携趣IP(api,请求地址,提交数据,请求头,cookies)
Import jsdvip.luae jsdvip.StartServer
dim ip = Url.Get(api)
api=Split(ip,:)
dim proxyHost = api(0)
dim proxyPort = api(1)
dim json= jsdvip.HttpGet (请求地址,提交数据,请求头,cookies,api(0),api(1))
Import cjson.lua Dim resp= Cjson.Decode(json)
If resp Then
TracePrint resp[body]
End If 携趣IP = resp
End Function
Function 多位随机数(位数)
Dim 全字符=0123456789 Dim 字符串= For 位数
字符串 = 字符串 & UTF8.StrGetAt(全字符, shanhai.RndEx(1,10))
Next 多位随机数 = 字符串
End Function
Function 多位随机字母(位数)
Dim 全字符=WERTYUIOPASDFGHJKLZXCVBNM Dim 字符串= For 位数
字符串 = 字符串 & UTF8.StrGetAt(全字符, shanhai.RndEx(1,26))
Next 多位随机字母 = 字符串
End Function
Function 多位随机数字字母(位数)
Dim 全字符=0123456789QWERTYUIOPASDFGHJKLZXCVBNM Dim 字符串= For 位数
字符串 = 字符串 & UTF8.StrGetAt(全字符, shanhai.RndEx(1,36))
Next 多位随机数字字母 = 字符串
End Function
Function 图灵付费版(apiKey,userId,text) Import shanhai.lua Dim 请求地址=http://openapi.tuling123.com/openapi/api/v2 Dim 请求数据 = {&&reqType&&:0,&&perception&&: {&&inputText&&: {&&text&&:&&text&&},},&&userInfo&&: {&&apiKey&&: &&apiKey&&,&&userId&&: &&Encode.Md5(userId)&&}} Dim 原始文本, 特征前,特征后,qpos,hpos,消息
原始文本 = URL.Post(请求地址, 请求数据)
特征前 = &values&&:{&&text&&:& 特征后 = &}}]} qpos=InStr(1, 原始文本, 特征前)
hpos = InStr(qpos, 原始文本, 特征后)
消息 = Mid(原始文本, qpos + Len(特征前), hpos - qpos - Len(特征前))
Dim 关键句=特地回复 Dim 回复句 = 特地回复替换 Dim 指定回复 = Split(回复句,/)
If InStr(1, 消息, 机器人) >= 1 Then
消息 = 嗯嗯啊啊嗯嗯~ ElseIf InStr(1, 关键句, 消息) >= 1 Then 消息 = shanhai.RandArray(指定回复)
ElseIf InStr(1, 消息, 4岁) >= 1 Then 消息 = 嘿嘿嘿~女人的年龄是不能说的秘密哦~ ElseIf InStr(1, 消息, 小主人) >= 1 Then 消息 = 你你你~ End If 图灵付费版=消息
End Function
Function 时间差(过去时间,当前时间)
Dim a = ShanHai.GetUnixTime(过去时间)
Dim b = ShanHai.GetUnixTime(当前时间)
Dim c = b - a
时间差 = c
End Function
Function 语音合成(内容,音量,语速)
Dim _token,token,session,path,结果
结果 = zm.HttpGet(http://www.zaixianai.cn/voiceCompose, utf-8, /sdcard/Pictures/hccookie.txt, )
_token = 取中间文本(结果, var token= & , & ;) session = 取中间文本(File.ReadLine(/sdcard/Pictures/hccookie.txt,6)&* , laravel_session , *)
token = 取中间文本(File.ReadLine(/sdcard/Pictures/hccookie.txt, 5) & *, XSRF-TOKEN , *)
Dim 请求地址 = http://www.zaixianai.cn/Api_getVoice Dim cookie=Hm_lpvt_d09fdf7e91f77cddf85908f081d4a3bc=&zm.Timestamp(GetNetworkTime())&;&Hm_lvt_d09fdf7e91f77cddf85908f081d4a3bc=&zm.Timestamp(GetNetworkTime())&;&laravel_session=&session&;&XSRF-TOKEN=&token Dim 提交数据=content=&内容&&volume=&音量&&speech_rate=&语速&&voice=Ninger&_token=&_token
Dim 合成结果
合成结果 = zm.HttpPost(请求地址,提交数据,UTF-8,,cookie)
Dim msn=Split (合成结果,)
Dim surl = http://www.zaixianai.cn/voice/&msn(11)
path = /sdcard/Pictures/ & msn(11)
zm.HttpDownload surl, path
语音合成 = path
End Function
Function 腾讯NLP机器人(SecretId, SecretKey, 聊天内容)
Dim wz = https://api.cloud.tencent.com/requesttc3 Dim sj=Product=nlp&Action=ChatBot&Version=2019-04-08&Region=ap-guangzhou&Token=&Area=&JsonData=%7B%22Query%22%3A%22&聊天内容&%22%7D&SecretId=&SecretId&&SecretKey=&SecretKey&&Language=zh-CN Dim back = url.Post(wz,sj)
Dim unicode = Split(back,)
腾讯NLP机器人 = zm.ConvUnicodeToUTF8(unicode(29))
End Function
Function 新界面(IntX,IntY,颜色)
Do If GetPixelColor(IntX,IntY)=颜色 Then
新界面 = True Exit Do Else ShowMessage 等待新界面 End If
LoopEnd Function
Function 找色(intX1, intY1, intX2, intY2, 颜色, 相似度)
Dim intX, intY
FindColor intX1, intY1, intX2, intY2, 颜色, 0, 相似度, intX, intY
If intX > -1 And intY > -1 Then
找色 = Array(intX,intY)
Else
找色 = Array(intX,intY)
End If
End Function
Function 找图(intX1, intY1, intX2, intY2, 附件名, 相似度) Dim intX, intY KeepCapture
FindPic intX1, intY1, intX2, intY2, Attachment: & 附件名, 000000, 0, 相似度, intX, intY
ReleaseCapture
If intX > -1 And intY > -1 Then
找图 = Array(intX,intY)
Else
找图 = Array(intX,intY)
End If
End Function
Function 心跳验证(卡密,status)
Dim json
json = URL.Get(http://sq.wzzlm.cn/php/mysqladminlite.php?env=development&db=sq&table=&sqlstmt=SELECT km,sttime,status,act FROM sqyz WHERE km = &卡密&&token=&action=exportjsononline)
Dim kmxx=Split(json,)
dim zxm=kmxx(11)
If zxm <> status Then
ShowMessage 您的卡密在其他设备登陆使用,本设备被踢下线,3000 Delay 3000 EndScript
End If
End Function
Function 授权验证(卡密,简称,status) If InStr(1, 卡密, 简称)=0 Then
ShowMessage 您输入的卡密不正确,请检查是否输入错误, 2000, 0, 0
Delay 2000
EndScript
End If Dim 月卡=UTF8.InStr(1,卡密, 简称&30) Dim 天卡=UTF8.InStr(1,卡密, 简称&1) Dim wz=http://sq.wzzlm.cn/php/mysqladminlite.php?env=development&db=sq&token= Dim json
json = URL.Get(http://sq.wzzlm.cn/php/mysqladminlite.php?env=development&db=sq&table=&sqlstmt=SELECT km,sttime,status,act FROM sqyz WHERE km = &卡密&&token=&action=exportjsononline) Dim kmxx=Split(json,)
dim km=kmxx(3),jhsj=kmxx(7),zxm=kmxx(11),jjzt=kmxx(15)
Dim 时间=GetNetworkTime()
Dim ztxg=sqlstmt=UPDATE+sqyz+SET+status%3D%27&status&%27+WHERE+km%3D%27&卡密&%27&env=development&db=sq&table=&token=//设置在线码 Dim syxg=sqlstmt=UPDATE+sqyz+SET+act%3D%271%27+WHERE+km%3D%27&卡密&%27&env=development&db=sq&table=&token=//设置激活状态为1 Dim xgst=sqlstmt=UPDATE+sqyz+SET+sttime%3D%27&时间&%27+WHERE+km%3D%27&卡密&%27&env=development&db=sq&table=&token=//设置激活时间 Dim sckm =sqlstmt=DELETE+FROM+sqyz++WHERE+km%3D%27&卡密&%27&env=development&db=sq&table=&token=//删除卡密 If km=null Then ShowMessage 您输入的卡密不正确或卡密已过期删除, 2000 Delay 2000 EndScript
ElseIf jjzt = 0 Then
ShowMessage 初次使用,正在激活您的卡密!,2000 Delay 2000 url.Post(wz,xgst) //设置激活时间 Delay 500 url.post(wz,ztxg)//设置在线码 Delay 500 url.post(wz,syxg)//设置激活状态为1 Delay 500 ShowMessage 您的卡密已经激活,激活时间为: & 时间 & \r\n & 本设备已上线,请勿在其他设备使用卡密,否则会导致本设备下线。, 2000 Delay 2000 ElseIf jjzt = 1 Then If 月卡>=1 and 时间差(jhsj,时间)/60/60/24 > 30 Then ShowMessage 您的卡密已过期!, 2000 url.Post(wz,sckm)//删除卡密 Delay 2000 EndScript
ElseIf 天卡>=1 and 时间差(jhsj,时间)/60/60 > 24 Then ShowMessage 您的卡密已过期!, 2000 url.Post(wz,sckm)//删除卡密 Delay 2000 EndScript
Else
ShowMessage 当前卡密有效,本设备已登陆,欢迎上线!\r\n请勿在其他设备使用卡密,否则会导致本设备下线。&\r\n当前卡密激活时间为: & jhsj, 5000 Delay 4000 url.post(wz,ztxg)//设置在线码 Delay 500 End If
End If
End Function
Function 取节点坐标(xml内容,节点特征)
Dim qwz,hwz,qpos,hpos,中间文本,x1,y1,x2,y2,x,y
qwz = InStr(1,xml内容,节点特征)
hwz = InStr(qwz,xml内容,bounds=)
qpos = InStr(hwz, xml内容, )
hpos = InStr(qpos+1, xml内容, )
中间文本=Mid(xml内容,qpos+len(),hpos-qpos-len())
x1 = CInt(取中间文本(中间文本, [,,))
y1 = CInt(取中间文本(中间文本, ,, ]))
x2 = CInt(取中间文本(中间文本, ][, ,))
y2 = CInt(取中间文本(中间文本, x2&,, ]))
x = CInt((x1 + x2) / 2)
y = CInt((y1 + y2) / 2)
取节点坐标 = Array(x,y)
End Function
Function 非直线滑动(x,y,x1,sfd,xfd,movetime)
Dim i,zzb,像素移动时长
像素移动时长 = movetime / (x1 - x)*10 TouchDown x,y, 1 For i = x To x1 step 10 If shanhai.RndEx(1, 2) = 1 Then
zzb = y+xfd//下浮动
Else
zzb = y-sfd//上浮动
End If TouchMove i, zzb, 1,像素移动时长
Next TouchUp 1
End Function