认识 DeekeScript Pro
本文档面向 DeekeScript Pro(以下简称 Pro)。
Pro 做三件事:
- AI 可编写的界面:用 JSON 描述页面长什么样,用
page.js填数据和对接点击。结构是声明式的,Cursor、ChatGPT 等大模型可以直接生成工作台、配置页、列表和表单。 - AI 可编写自动化脚本:把界面上的节点信息、各类弹窗等信息提供给 AI,它就能辅助写出
tasks/*.js。效果没有写 UI 那么惊艳,但能明显加快脚本开发。 - 执行脚本:在 Android 上跑无障碍自动化(点击、滑动、找节点),代码写在
tasks/*.js。
界面不是原生 Android 布局,而是用 JSON 描述的声明式页面。因为页面就是 JSON,所以 核心能力是:AI 能帮你把 UI 写出来;脚本层同样可以交给 AI,只是需要你补上节点和弹窗等信息。
目前市面上少有能让开发者高度定制 UI 页面的 Android 自动化框架;Pro 把这一层做成了工程约定,因此也适合交给 AI。
可以做成下面这样(点「开始运行」、底栏、最近记录):
{
"title": {
"text": "工作台",
"fontSize": 18,
"color": "#FFFFFF",
"background": "#006A65"
},
"style": {
"padding": 10,
"background": "#F5F5F5"
},
"body": [
{
"type": "card",
"style": {
"padding": 0,
"gap": 0
},
"children": [
{
"type": "image",
"src": "img/banner.svg",
"fit": "cover",
"style": {
"height": 88,
"radius": 0,
"width": "match"
}
},
{
"type": "column",
"style": {
"padding": 12,
"gap": 8
},
"children": [
{
"type": "text",
"text": "{{hello}}",
"style": {
"fontWeight": "bold",
"fontSize": 16
}
},
{
"type": "notice",
"text": "今日脚本已就绪,可以开始运行"
},
{
"type": "button",
"text": "开始运行",
"size": "中",
"action": {
"type": "navigate",
"page": "task",
"params": {
"id": "dy"
}
}
}
]
}
]
},
{
"type": "space",
"height": 8
},
{
"type": "grid",
"bind": "metrics",
"columns": 2,
"item": {
"type": "card",
"style": {
"padding": 12,
"gap": 4
},
"children": [
{
"type": "notice",
"text": "{{item.label}}"
},
{
"type": "title",
"text": "{{item.value}}",
"style": {
"color": "#006A65"
}
}
]
}
},
{
"type": "text",
"text": "常用功能",
"style": {
"fontWeight": "bold"
}
},
{
"type": "grid",
"bind": "apps",
"columns": 3,
"item": {
"type": "card",
"action": {
"type": "navigate",
"page": "task",
"params": {
"id": "{{item.id}}"
}
},
"style": {
"padding": 8,
"gap": 8
},
"children": [
{
"type": "image",
"src": "{{item.icon}}",
"style": {
"width": "50%"
}
},
{
"type": "text",
"text": "{{item.name}}",
"style": {
"fontSize": 11,
"align": "center"
}
}
]
}
},
{
"type": "card",
"children": [
{
"type": "column",
"style": {
"gap": 6
},
"children": [
{
"type": "text",
"text": "今日安排",
"style": {
"fontWeight": "bold"
}
},
{
"type": "notice",
"text": "先跑主任务,再处理子脚本"
}
]
},
{
"type": "list",
"bind": "tags",
"direction": "row",
"item": {
"type": "tag",
"text": "{{item.label}}",
"action": {
"type": "toast",
"text": "{{item.label}}"
}
}
}
]
},
{
"type": "text",
"text": "最近记录",
"style": {
"fontWeight": "bold"
}
},
{
"type": "list",
"bind": "logs",
"item": {
"type": "card",
"action": {
"type": "navigate",
"page": "detail",
"params": {
"id": "{{item.id}}"
}
},
"children": [
{
"type": "row",
"style": {
"gap": 10
},
"children": [
{
"type": "image",
"src": "{{item.icon}}",
"style": {
"width": 36,
"height": 36,
"radius": 8
}
},
{
"type": "column",
"style": {
"weight": 1,
"gap": 4
},
"children": [
{
"type": "text",
"text": "{{item.title}}",
"style": {
"fontWeight": "bold"
}
},
{
"type": "notice",
"text": "{{item.time}}"
}
]
},
{
"type": "tag",
"text": "{{item.status}}",
"style": {
"background": "#E6F4F1",
"color": "#006A65"
}
}
]
}
]
}
},
{
"type": "loading",
"text": "加载中",
"showIf": "loading"
},
{
"type": "text",
"text": "{{footer}}",
"showIf": "noMore",
"style": {
"align": "center",
"color": "#9AA8A6",
"fontSize": 12
}
}
]
}UI
你好,Pro
今日脚本已就绪,可以开始运行
运行中
3
已完成
128
排队
8
失败
2
常用功能
点击控件
图色查找
循环任务
今日安排
先跑主任务,再处理子脚本
脚本无障碍图色悬浮球
最近记录
点击控件
10:21
图色查找
10:40
循环任务
09:12
定时执行
08:55
日志回传
08:30
两种用法
| 你要做什么 | 需要什么 | 怎么跑 |
|---|---|---|
| 自己做界面(推荐 AI 生成),再点按钮跑任务 | deekeScript.json + pages/(可选 components/)+ tasks/*.js | 手机刷新进页面,点击按钮调用 Engines.executeScript |
| 只跑无障碍脚本 | deekeScript.json + tasks/*.js | VSCode 打开任务文件,「仅当前文件执行」 |
必须有入口文件
无论是否做界面,项目根目录必须有 deekeScript.json,否则无法使用 VSCode 中的 DeekeScript 插件(无法同步代码、无法在 VSCode 上运行 JS)。
带界面时工程怎么组成
your-project/
deekeScript.json # 必须有:识别工程;做界面时写首页、底栏、全局窗口
pages/home/
page.json # 这一页长什么样(可让 AI 生成)
page.js # 数据、点击、跳转
components/choose/ # 自定义组件(可选)
common/ # 公共 JS
tasks/sample.js # 真正跑自动化的脚本- JSON / page.js 只负责界面;不要把长任务塞进 JSON 的
action - tasks/*.js 写无障碍点击、滑动
- 目录约定见 动态页面 · 概述
