- 超级版主
- 1228894
- 26989
- 25
- 8064 朵
- 36143 个
- 4760 个
- 421340
- 2012-07-18
|
1#
t
T
发表于 2022-03-09 22:07
|
|只看楼主
说明:本地文字识别(不带坐标版):下载地址:作者群:894542783 链接: https://share.weiyun.com/7ChVuZVq 密码:dr6t3j 本地识别(坐标版):代码一览:- Import "ShanHai.lua"
- //TracePrint 识别(0,0,0,0)
- //Call 点击("日志", 20, 50, 200, 200)
- //TracePrint 判断是否存在("日志", 20, 50, 200, 200)
- Do
- Call 点击("系统应用",11,173,554,446)
- Call 点击("设置", 11, 173, 554, 446)
- Delay 1000
- KeyPress "back"
- KeyPress "back"
- Loop
- Function 识别(x1, y1, x2, y2)
- SnapShot "/sdcard/N7.png",x1, y1, x2, y2
- Dim js="let ocrResult = ocr("""&"/sdcard/N7.png"&""");ocrResult!=null?JSON.stringify(ocrResult):false"
- Dim co="http://127.0.0.1:9999/script?js=" & ShanHai.CharToUrl(js)
- 识别=URL.Get(co, 6 * 10000)
- End Function
- Sub 点击(内容,x1, y1, x2, y2)
- Dim 识别结果,识别数组 ,分割1,分割2,分割3,x,y
- 识别结果 = 识别(x1, y1, x2, y2)
- //TracePrint 识别结果
- 识别数组 = GetStrAB(识别结果, "{", "}")
- For i = 0 To UBOUND(识别数组)-1
- //TracePrint 识别数组(i)
- If InStr(1, 识别数组(i), 内容) > 0 Then
- TracePrint 识别数组(i)
- 识别数组(i) = Replace(识别数组(i), "[[", "[")
- 识别数组(i) =Replace( 识别数组(i),"]]","]")
- 分割1 = GetStrAB(识别数组(i), "[", "]")
- //TracePrint 分割1(0),分割1(2)
- 分割2 = Split(分割1(0), ",")
- 分割3 = Split(分割1(2), ",")
- x = (分割3(0) - 分割2(0))/2+分割2(0)+x1
- y = (分割3(1) - 分割2(1))/2+分割2(1)+y1
- TracePrint int(x),int(y)
- Tap Int(x), Int(y)
- Delay 1000
- End If
- Delay 20
- Next
- End Sub
- Function 判断是否存在(内容, x1, y1, x2, y2)
- 判断是否存在=False
- Dim 识别结果,识别数组 ,分割1,分割2,分割3,x,y
- 识别结果 = 识别(x1, y1, x2, y2)
- //TracePrint 识别结果
- If InStr(1, 识别结果, "labelName" & Chr(34) & ":" & Chr(34) & 内容 & Chr(34)) > 0 Then
- 判断是否存在=True
- End If
- End Function
- //当前脚本第16行:"labelName":"log(调用(代码))","rect":[[2,1036],[209,1036],[209,1068],[2,1068]]
- Function GetStrAB(Str, StrA, StrB)
- Dim i,ArrStrA,Ck,分割
- ArrStrA=Split(Str,StrA)
- For i = 1 To UBOUND(ArrStrA)
- 分割=Split(ArrStrA(i),StrB)
- If InStr(1,ArrStrA(i), StrB) > 0 Then
- Ck = Ck & 分割(0) &"|||"
- End If
- Next
- GetStrAB=split( Ck,"|||")
- End Function
复制代码 下载地址:链接: https://share.weiyun.com/WGtFppFv 密码:dh6dia
|