File tree Expand file tree Collapse file tree 3 files changed +67
-1
lines changed
Expand file tree Collapse file tree 3 files changed +67
-1
lines changed Original file line number Diff line number Diff line change 1+ # 从外部运行 Autox 脚本
2+
3+ Autox 提供了一些接口,支持从其他设备或 app 调用并运行脚本
4+
5+ ## VsCode 插件
6+
7+ 支持连接设备并进行开发调试等,由先前开发者编写,目前已许久没有维护,但目前任然兼容,
8+ [ 下载地址] ( https://marketplace.visualstudio.com/items?itemName=aaroncheng.auto-js-vsce-fixed )
9+ 也可以在 VsCode 插件商店搜索` Autox.js ` 下载安装
10+
11+ ## Autox cli 工具
12+
13+ > 需要 Autox V7 7.1.5 版本及以上,并且在侧边栏打开 usb 调试
14+
15+ 支持通过 cli 运行项目及文件,保存项目到手机等,需要 nodejs 环境
16+
17+ - 安装
18+
19+ ```
20+ npm i autox-cli -g
21+ ```
22+
23+ - 运行脚本或项目
24+
25+ ```
26+ autox run path
27+ ```
28+
29+ 将 path 替换为要运行的脚本文件或项目目录
30+
31+ - 保存项目到设备
32+
33+ ``` sh
34+ autox save path
35+ # or
36+ autox save path --devip 192.168.1.111 --name 保存名称
37+ ```
38+
39+ path 必须是一个目录,会将该目录覆盖到脚本主目录文件夹
40+
41+ 运行` autox -h ` 可查看所有命令
42+
43+ ## 通过应用广播运行
44+
45+ - 显式调用
46+
47+ 此方式会显示一个对话框提醒用户
48+
49+ ```
50+ adb shell am start -n org.autojs.autoxjs.v7/org.autojs.autojs.external.open.OpenIntentActivity -d "file:///sdcard/script.js"
51+ ```
52+
53+ - 隐式调用
54+
55+ > 此功能需要在设置中打开 "允许广播运行脚本" 开关
56+
57+ ```
58+ adb shell am start -n org.autojs.autoxjs.v7/org.autojs.autojs.external.open.RunIntentActivity -d "file:///sdcard/script.js"
59+ ```
60+
61+ app 应用中参考以上方式设置 intent 即可
Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ const config: Config = {
6969 docId : 'overview' ,
7070 label : '综述' ,
7171 } ,
72+ {
73+ type : 'doc' ,
74+ docId : 'external_support' ,
75+ label : '从外部运行 Autox 脚本' ,
76+ } ,
7277 {
7378 type : 'docSidebar' ,
7479 sidebarId : 'tutorialSidebar' ,
Original file line number Diff line number Diff line change 11{
22 "name" : " autox-doc" ,
3- "version" : " 0.0.4 " ,
3+ "version" : " 0.0.5 " ,
44 "private" : true ,
55 "scripts" : {
66 "docusaurus" : " docusaurus" ,
You can’t perform that action at this time.
0 commit comments