{
"variables": {},
"execute": []
}
schedule、if、for、whiledelay、set、echo、random、loginput、click、locate、press、swipe、scroll、keyeventocr-chat、extract-messages、ocr-chat-history、extract-chat-history、read-last-message、smart-chat-append、save-messages、generate-summary、generate-history-summary、read-txt / read-text、save-txt / save-text、img-center-point-location、img-bounding-box-location、img-cropping、ai-generate、string-pressschedule(定时执行)
{ "type": "schedule", "condition": { "interval": "1s", "repeat": -1 }, "interval": [] }
condition.interval:间隔(如 "1s"、"2m"、"3h")。condition.repeat:次数,-1 或 "forever" 为无限。interval:每次执行的操作数组。if(条件判断)
{ "type": "if", "condition": "{变量} == '值'", "then": [], "else": [] }
condition 支持 {变量}、== != > < >= <=、&& ||。兼容旧字段 ture。for(循环)
{ "type": "for", "variable": "{item}", "items": [1, 2, 3], "body": [] }
variable:当前元素变量。items:数组(可写 "{listVar}")。body:每轮操作数组。while(循环)
{ "type": "while", "condition": "{变量} > 0", "body": [] }
condition 同 if。body:循环体。兼容旧字段 ture。delay(延迟)
{ "type": "delay", "value": "2s" }
delay。单位:s、m、h。set(变量设置)
{ "type": "set", "variable": "{name}", "value": "value" }
number(整数或小数)、string(字符串)、bool(true / false)。写入后参与运算或比较时按上述类型处理;布尔在变量上下文中以 "1" / "0" 存储。value 支持 {var} 替换;含 +、-、*、/ 时按算术表达式求值。变量定义在根级 variables,引用用 "{name}",echo 中拼接用 {{name}}。echo(打印console.log信息)
{ "type": "echo", "value": "消息: {{var}}" }
或
{ "type": "echo", "inVars": ["{var1}", "{var2}"] }
log(仅 UI 输出)
{ "type": "log", "value": "调试信息" }
或
{ "type": "log", "inVars": ["{var}"] }
random(随机数)
{ "type": "random", "inVars": ["1", "100"], "outVars": ["{randomNum}"], "integer": true }
inVars[0/1]:最小/最大值。outVars[0]:结果变量。integer 默认 true。传统写法 variable、min、max 仍支持。{ "type": "input", "value": "文本", "clear": false }
{ "type": "click", "target": "{\"x\":100,\"y\":200}" }
{ "type": "locate", "method": "image", "target": "resources/icon.png", "variable": "{pos}" }
{ "type": "press", "value": "resources/btn.png" }
{ "type": "swipe", "value": "up-down" }
{ "type": "scroll", "value": "down" }
{ "type": "keyevent", "value": "4" }
通用基础结构(多数扩展标签)
{ "type": "标签名", "inVars": [], "outVars": [] }
各扩展标签基础结构示例:
fun(method 为 func 目录下脚本名)
{ "type": "fun", "method": "脚本文件名", "inVars": [], "outVars": [] }
ocr-chat / extract-messages / ocr-chat-history / extract-chat-history
{ "type": "ocr-chat", "inVars": ["(r,g,b)", "(r,g,b)", "区域坐标JSON"], "outVars": ["{chatHistory}"] }
read-last-message
{ "type": "read-last-message", "inVars": ["{chatJson}"], "outVars": ["{text}", "{sender}"] }
smart-chat-append
{ "type": "smart-chat-append", "inVars": ["{history}", "{current}"], "outVars": ["{merged}"] }
read-txt / read-text
{ "type": "read-txt", "inVars": ["history/chat-history.txt"], "outVars": ["{content}"] }
save-txt / save-text
{ "type": "save-txt", "inVars": ["{content}", "history/out.txt"], "outVars": [] }
img-center-point-location
{ "type": "img-center-point-location", "inVars": ["template.png"], "outVars": ["{pos}"] }
img-bounding-box-location
{ "type": "img-bounding-box-location", "inVars": ["ScreenShot.jpg", "ChatArea.png"], "outVars": ["{corners}"] }
img-cropping
{ "type": "img-cropping", "inVars": ["{areaJson}", "history/crop.png"], "outVars": [] }
ai-generate
{ "type": "ai-generate", "prompt": "请总结:{{input}}", "inVars": ["{input}"], "outVars": ["{result}"] }
string-press
{ "type": "string-press", "inVars": ["确定"], "outVars": [] }