Git Product home page Git Product logo

autojs6-documentation's Introduction

autojs6-documentation-banner_800×208_transparent

AutoJs6 应用文档

Version name GitHub closed issues Created
GitHub Code Size GitHub License JetBrains supporter


简介



阅读



说明


  • 文档可能会随时更新
  • 部分文档与实际代码行为可能存在出入
  • 如有任何问题可在当前项目的 议题 (Issues) 页面提交反馈
  • 如需快速了解文档的常见问题, 可参阅 疑难解答 章节

进度


  • 基于 Auto.js 4.1.0 文档修改完善, 部署进度 可能相对缓慢

版本历史


v1.1.8

2023/12/01

v1.1.7

2023/10/30

v1.1.6

2023/07/21

更多版本历史可参阅

autojs6-documentation's People

Contributors

fazx avatar hyb1996 avatar ilvsx avatar lisgroup avatar liuyib avatar super-ppx avatar supermonster003 avatar sxzz avatar w582712768 avatar wukuai avatar zhangyaosong avatar zmoki688 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

autojs6-documentation's Issues

无法使用<com.stardust.autojs.core.console.ConsoleView id="console" margin="10" gravity="center" />

var window = floaty.window(


<com.stardust.autojs.core.console.ConsoleView id="console" margin="10" gravity="center" />


);

浮动窗口添加控制台报错
报错内容:
Wrapped android.view.InflateException: android.view.InflateException: java.lang.ClassNotFoundException: com.stardust.autojs.core.console.ConsoleView (file:///android_asset/modules/floaty.js#50)
Wrapped android.view.InflateException: android.view.InflateException: java.lang.ClassNotFoundException: com.stardust.autojs.core.console.ConsoleView
at file:///android_asset/modules/floaty.js:50:0
at file:///android_asset/modules/floaty.js:48:0
at $remote/cg.js:3:0

websocket会在启动后大概30多秒后报错

image

每次启动后都会出现 , 我 js 有心跳包 每次 3秒ping 一下,大概在30S后会出现这个错误,出现后会自动重连(我自己没写重连代码,好像是自带的),重连后这个错误就没有了

image

无法上传图片至api识别

// 截取zs至yx范围内的图片。
if (title && ekp) {
var height = yx.y - zs.y; // 计算截图高度
var width = yx.x - zs.x; // 计算截图宽度
var screenshot = images.captureScreen();
var croppedImage = images.clip(screenshot, zs.x, zs.y, width, height); // 截取zs至yx范围内的图片
log("截取图片成功");

// 文件保存到:sdcard/脚本/安卓自动化/linshijietu文件夹内
var dirPath = "/sdcard/脚本/安卓自动化/linshijietu"; // 定义目录路径
files.ensureDir(dirPath); // 确保目录存在
log(`目录路径为:${dirPath}`);

// 定义图片地址,检查文件扩展名是否为'jpg'
var fileName = "croppedImage.jpg"; // 定义文件名
var fileExt = files.getExtension(fileName); // 获取文件扩展名
if (fileExt != "jpg") { // 判断文件扩展名是否为'jpg'
  log("文件扩展名不是'jpg',修改为'jpg'");
  fileName = files.getNameWithoutExtension(fileName) + ".jpg"; // 修改文件扩展名为'jpg'
}
log(`文件名为:${fileName}`);

// 构建文件路径:将目录路径和文件名拼接成完整的文件路径
var filePath = files.path(files.join(dirPath, fileName)); // 拼接并返回文件路径
log(`文件路径为:${filePath}`);

// 保存图片到文件路径
images.save(croppedImage, filePath, "jpg"); // 保存图片到文件路径
log("保存图片成功");

title = null; // 删除标题控件参数
ekp = null; // 删除ekp控件参数
titleBounds = null; // 删除标题控件bounds元素
ekpBounds = null; // 删除ekp控件bounds元素
titleCoords = null; // 删除标题控件座标点的参数
ekpCoords = null; // 删除ekp控件座标点的参数
zs = null; // 删除zs坐标点
yx = null; // 删除yx坐标点
height = null; // 删除截图高度
width = null; // 删除截图宽度

} else {
log("无法截取图片");
}
// 连接至ocr端口:http://173.249.197.34:12345/savelmage",将该截图文件上传至该api接口后删除该截图的本地存储并释放内存。
if (croppedImage) {

var ocrUrl = "http://173.249.197.34:5000/image"; // 定义ocr接口地址

 try { // 使用try...catch语句来处理可能出现的异常

// 使用files.open()方法打开图片文件,并指定读取模式为'r'
var fileObj = files.open(filePath, 'r');
if (fileObj) {
log("打开文件成功");
log(fileObj); // 打印文件对象的内容

    // 构建文件参数:创建一个包含文件参数的字典files,其中'file'是键,文件名、文件对象和文件类型('image/jpg')组成的元组是值。
    var fileParams = {file: [fileName, fileObj, "image/jpg"]}; // 创建文件参数字典
    log("构建文件参数成功");
    
    // 发送POST请求,将文件参数作为files参数传递给函数
    var response = http.postMultipart(ocrUrl, {}, fileParams);  // 发送POST请求
    log("发送POST请求成功");
    
    // 删除本地文件并释放内存
    files.remove(filePath); // 删除本地文件
    croppedImage.recycle(); // 释放图片内存
    screenshot.recycle(); // 释放截屏内存
    fileObj.close(); // 关闭文件对象
    log("删除本地文件并释放内存成功");
    
    // 获取返回的字符串
    var bodyString = response.body.string();
    log(`返回的字符串为:${bodyString}`);
    
    // 判断返回的字符串是否是json格式
    var isJson = true;
    try {
      JSON.parse(bodyString);
    } catch (e) {
      isJson = false;
    }
    
    if (isJson) {
      // 解析返回的json数据
      var json = response.body.json();
      if (json) {
        if (json.result == 0) { // 判断result是否为0
          log("返回参数result为0,跳转执行步骤7");
          step7(); // 执行步骤7
        } else if (json.result == 1) { // 判断result是否为1
          log("返回参数result为1,将附加文本赋值给变量");
          var text = json.identify_lines; // 将附加文本赋值给变量
          step11(text); // 执行下一步,并传入附加文本
        } else {
          log("返回参数无效");
        }
      } else {
        log("返回数据不是json格式");
      }
    } else {
      log("返回数据不是json格式");
    }
  } else {
    log("无法打开文件");
  }
  
} catch (e) { // 捕获异常并打印错误信息
  log(e.message);
}

} else {
log("无法上传图片");
}
}

以上代码运行报错,无法修复,请给予技术支持,非常感谢。报错如下:
15:33:33.969/D: [七月 15, 2023 3:33:33 下午 GMT+08:00] 保存图片成功

15:33:33.971/D: [七月 15, 2023 3:33:33 下午 GMT+08:00] 打开文件成功

15:33:33.972/D: [七月 15, 2023 3:33:33 下午 GMT+08:00] org.autojs.autojs.pio.PReadableTextFile@e29793f

15:33:33.973/D: [七月 15, 2023 3:33:33 下午 GMT+08:00] 构建文件参数成功

15:33:33.975/D: [七月 15, 2023 3:33:33 下午 GMT+08:00] java.lang.IllegalStateException: Multipart body must have at least one part.

15:33:33.977/V: [$remote/3.js] 运行结束 (用时 12.177 秒)

AJ6 超级用户异常

在VMOS PRO中使用AJ6,
使用以下命令时,一直获取不到超级用户权限。(只要和超级用户有关的命令,都无法运行)。但是AJ6设置里的root下自动开发无障碍这个可以正常运行
var sh = new Shell(true);
var dd=sh.exec("am force-stop com.sinovatech.unicom.ui");
sh.exit();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.