{"repeatCount":-1,"pauseOnFail":true,"count":17,"minVerCode":29,"minVerName":"2.1.3","screenWidth":1440,"screenHeight":3200,"screenDpi":3.75,"lastSaveScreenWidth":1440,"lastSaveScreenHeight":3200,"lastSaveScreenDpi":3.75,"savedVerCode":2028030,"savedVerName":"2.28.3","description":""}
{"type":"点击","duration":"110","delayUnit":1,"posData":{"type":"location","x":"38.9%","y":"72%"}}
{"type":"点击","duration":"91","delay":"3343","delayUnit":0,"posData":{"type":"location","x":"67.8%","y":"101%"}}
{"type":"点击","duration":"94","delay":"4183","delayUnit":0,"posData":{"type":"location","x":"15.5%","y":"45.2%"}}
{"type":"点击","duration":"103","delay":"5912","delayUnit":0,"posData":{"type":"location","x":"60.3%","y":"71.7%"}}
{"type":"滑动","duration":"973","delay":"5651","delayUnit":0,"startPos":{"type":"location","x":"59.9%","y":"86.1%"},"endPos":{"type":"location","x":"66%","y":"50.1%"}}
{"type":"滑动","duration":"809","delay":"4617","delayUnit":0,"startPos":{"type":"location","x":"58.2%","y":"84.9%"},"endPos":{"type":"location","x":"56%","y":"58.8%"}}
{"type":"滑动","duration":"725","delay":"2843","delayUnit":0,"startPos":{"type":"location","x":"55.6%","y":"88.2%"},"endPos":{"type":"location","x":"51.8%","y":"60.9%"}}
{"type":"滑动","duration":"840","delay":"2836","delayUnit":0,"startPos":{"type":"location","x":"55.4%","y":"87.2%"},"endPos":{"type":"location","x":"55.5%","y":"58.1%"}}
{"type":"滑动","duration":"608","delay":"4850","delayUnit":0,"startPos":{"type":"location","x":"60.5%","y":"72.2%"},"endPos":{"type":"location","x":"64.1%","y":"44.4%"}}
{"type":"滑动","duration":"737","delay":"4301","delayUnit":0,"startPos":{"type":"location","x":"66.9%","y":"70.9%"},"endPos":{"type":"location","x":"69.2%","y":"45.9%"}}
{"type":"滑动","duration":"701","delay":"2964","delayUnit":0,"startPos":{"type":"location","x":"68.6%","y":"69.3%"},"endPos":{"type":"location","x":"70.6%","y":"44.6%"}}
{"type":"滑动","duration":"713","delay":"3454","delayUnit":0,"startPos":{"type":"location","x":"65.4%","y":"70.8%"},"endPos":{"type":"location","x":"69.9%","y":"45.7%"}}
{"type":"滑动","duration":"626","delay":"3011","delayUnit":0,"startPos":{"type":"location","x":"65.9%","y":"70.1%"},"endPos":{"type":"location","x":"67.9%","y":"44.7%"}}
{"type":"滑动","duration":"463","delay":"3085","delayUnit":0,"startPos":{"type":"location","x":"67.1%","y":"67.5%"},"endPos":{"type":"location","x":"74.1%","y":"42.4%"}}
{"type":"点击","duration":"114","delay":"3824","delayUnit":0,"posData":{"type":"location","x":"5.9%","y":"7.3%"}}
{"type":"点击","duration":"135","delay":"8489","delayUnit":0,"posData":{"type":"location","x":"3.9%","y":"7.5%"}}
{"type":"按键","duration":"0","delay":"5642","delayUnit":0,"keyCode":3}
回答
这是Hamibot录制的自动化脚本导出数据,我来为你详细解释:
这个脚本包含17个操作步骤(8次点击、8次滑动、1次返回键),使用相对坐标百分比定位元素。脚本设计针对1440×3200分辨率的设备(DPI 3.75),通过百分比坐标确保在不同分辨率设备上自动适配。
关键特性说明:
-
相对坐标系统
所有操作使用百分比坐标(如x:"38.9%", y:"72%"),Hamibot会自动根据当前设备分辨率换算实际坐标。例如在1080p设备上,"38.9%"会换算为屏幕宽度的38.9%位置。 -
分辨率适配
脚本元数据中已记录设计分辨率(screenWidth:1440, screenHeight:3200),Hamibot运行时会自动调用类似setScreenMetrics(1440, 3200)的机制进行坐标缩放,无需手动处理不同机型适配问题。 -
操作类型说明
- 点击操作:
click(x, y)
例如:{"type":"点击","posData":{"x":"38.9%","y":"72%"}}对应代码:// 文档地址 https://docs.hamibot.com/ let x = device.width * 0.389; let y = device.height * 0.72; click(x, y); - 滑动操作:
swipe(x1, y1, x2, y2, duration)
例如:{"type":"滑动","startPos":{"x":"59.9%","y":"86.1%"},"endPos":{"x":"66%","y":"50.1%"},"duration":"973"} - 按键操作:
keycode(3)对应返回键
- 点击操作:
-
执行参数
- delay:操作前等待时间(毫秒)
- duration:操作持续时间(点击时为按压时长,滑动时为滑动速度控制)
使用建议:
- 直接导入Hamibot即可运行,系统会自动处理坐标转换
- 如需修改,建议在Hamibot的"动作编辑"界面调整,避免手动编辑JSON
- 当y坐标超过100%(如"101%")时,说明录制时包含状态栏区域,脚本会自动向下偏移状态栏高度
- 若在低分辨率设备运行,建议添加屏幕适配代码:
// 文档地址 https://docs.hamibot.com/ setScreenMetrics(1440, 3200);
注意:普通点击/滑动操作不需要root权限,但部分特殊场景(如系统级弹窗)可能需要使用RootAutomator。这个脚本使用的是标准自动化API,兼容Android 7.0以上设备。