Evan
Evan - 认证专家

注册于 5年前

回答
310
文章
36
关注者
39

截图后放大图片识别这个手册有写,还可以自己做字库
#本地OCR识别训练字库

什么机器?点击没反应是写脚本点击没反应还是哪里点击没反应

function main()
    math.randomseed(tostring(os.time()):sub(5):reverse()); -- 随机种子
    x = math.random(1, 20);
    if x == 1 then 
        a
    elseif x == 2 then
        b
    elseif x == 3 then
        c
    end
end

function main()
  html = [[
    <!DOCTYPE html>
    <html lang="zh-CN">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
        <!-- 加载UI框架 -->
        <link
          href="file:///var/touchelf/var/res/www/bootstrap/bootstrap.min.css"
          rel="stylesheet"
        />
      </head>
    
      <body>
        <div class="shadow-sm p-3 mb-5 bg-white rounded"
    
          <!-- 单选框 -->
          <div class="form-check form-check-inline">
          <!-- value填写坐标的值 ,只需要修改这里即可-->
            <input class="form-check-input" type="radio" name="inlineRadioOptions" id="a" value="100,100" checked>
            <label class="form-check-label" for="inlineRadio1">坐标a</label>
          </div>
          <div class="form-check form-check-inline">
            <input class="form-check-input" type="radio" name="inlineRadioOptions" id="b" value="100,200">
            <label class="form-check-label" for="inlineRadio2">坐标b</label>
          </div>
          <div class="form-check form-check-inline">
            <input class="form-check-input" type="radio" name="inlineRadioOptions" id="c" value="200,200">
            <label class="form-check-label" for="inlineRadio3">坐标c</label>
          </div>
          <div class="form-check form-check-inline">
            <input class="form-check-input" type="radio" name="inlineRadioOptions" id="d" value="200,300">
            <label class="form-check-label" for="inlineRadio4">坐标d</label>
          </div>
          <!-- 按钮 -->
          <div style="padding-top: 10px">
            <button type="button" class="btn btn-primary" onclick="onOk()">
              确定
            </button>
            <button type="button" class="btn btn-danger" onclick="onCancel()">
              取消
            </button>
          </div>
        </div>
    
        <script>
          // touchelf.return()为触摸内置函数, 此函数将关闭UI, 并将数据发送给sys.ui.show(), 作为其返回值
          function onOk() {
            touchelf.return(
              JSON.stringify({
                type: "ok",
                // 单选框值
                p: document.querySelector("input[type='radio']:checked").value
              })
            );
          }
          function onCancel() {
            touchelf.return(JSON.stringify({ type: "cancel" }));
          }
        </script>
        <!-- 加载框架JS -->
        <!-- IOS路径 -->
        <script
          src="file:///var/touchelf/var/res/www/bootstrap/bootstrap.bundle.min.js">
        </script>
      </body>
    </html>
    
  ]]
  --将html写入文件
  flag,err = file.write("/var/touchelf/input.html",html);
  res = sys.ui.show("/var/touchelf/input.html",100,100,500,500)
  sys.log(res)
  --json转table
  t = codec.json.decode(res)
  point = t.p:split(',')
  sys.log(point)
  touch.tap(point[1],point[2]);
end

function main()
  html = [[
    <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
  </head>

  <body>
  <!-- 输入框设置-->
    <input id="a" type="text" value="坐标a"/>
    <input id="b" type="text" value="坐标b"/>
    <input id="c" type="text" value="坐标c"/>
    <!-- 按钮区域,此处必须写,否则无法关闭动态UI-->
    <div style="padding-top: 10px">
        <!-- onOk()和onCancel()需要和JS内的function onOk() function onCancel()对应 -->
      <button onclick="onOk()">确定</button>
      <button onclick="onCancel()">取消</button>
    </div>

    <script>

      function onOk() {
        // 获取输入框内的值
        var data = {
          a: document.getElementById("a").value,
          b: document.getElementById("b").value,
          c: document.getElementById("c").value,
        };

        // touchelf.return()为触摸内置函数, 此函数将关闭UI, 并将数据发送给sys.ui.show(), 作为其返回值
        touchelf.return(
          JSON.stringify({
            type: "ok",
            data: data,
          })
        );
      }

      function onCancel() {
        touchelf.return(JSON.stringify({ type: "cancel" }));
      }
    </script>
  </body>
</html>
  ]]
  --将html写入文件
  flag,err = file.write("/var/touchelf/input.html",html);
  res = sys.ui.show("/var/touchelf/input.html",100,100,400,500)
  sys.log(res)
  --json转table
  t = codec.json.decode(res)
  --用,分割 坐标填写方式  100,100
  a = t.data.a:split(',')
  b = t.data.b:split(',')
  c = t.data.c:split(',')
  sys.log(a)
  --点击坐标.延迟什么的自己加吧
  touch.tap(a[1],a[2]); 
  touch.tap(b[1],b[2]); 
  touch.tap(c[1],c[2]); 
end

用os.time(),开始的时候记录一下,结束的时候记录一下,两个相减就算出来多少秒了

用sys.exec执行date命令
使用命令:“date -s 完整日期时间(YYYY-MM-DD hh:mm[:ss])”

sys.exec("date -s 2022-5-20 10:20:30")

社区购买的才会计入到登录的账号中。其他渠道不计数

color = {
    {{0x7efdfd, 1, 0, 0x66f0f7, 2, 0, 0x93eff7, 3, 0, 0x8be3e9}, 96, 226, 694, 641, 1282},
    {{0x85fcfc, 1, 0, 0x55f4fa, 2, 0, 0x87ecfa, 3, 0, 0x6ee1f1}, 96, 226, 694, 641, 1282},
    {{0x6df7fe, 1, 0, 0x59f9f9, 2, 0, 0x81eff9, 3, 0, 0x7ae0f0}, 96, 226, 694, 641, 1282}
}
function colortep(t)
    for k, v in pairs(t) do
        x,y = screen.findColor(v[1],v[2],v[3],v[4],v[5],v[6])
        if x ~= -1 and y ~= -1 then
            sys.log(string.format("找到%s点双击坐标",k))
            touch.tap(x, y)
            sys.sleep(100)
            touch.tap(x, y)
            sys.sleep(200)
            touch.tap(0, 0)
            sys.sleep(200)
            break;
        end
    end
end
function main()
    colortep(color)
end

登录超时两个原因
1是时间问题
2是访问社区超时,这个检查一下网络,尝试更换下dns试试

发布
问题