AutoX
AutoX copied to clipboard
captureScreen
示例
// 配置参数
let config = require('./config.json');
requestScreenCapture();
sleep(1000);
test();
function test() {
while (true) {
let img = captureScreen();
// let img = images.read("./test.png");
for (let key in config) {
let value = config[key];
let point = findMultiColors(img, value.firstColor, value.colors, value.options);
if (point) {
log(`找到${value.name},坐标:${point}`);
// click(point.x, point.y);
}
}
img.recycle();
sleep(300);
}
}
报错
11:39:20.544/E: Wrapped java.lang.IllegalStateException: image has been recycled (/android_asset/modules/__images__.js#397)
Wrapped java.lang.IllegalStateException: image has been recycled
at /android_asset/modules/__images__.js:397:0
at test (/storage/emulated/0/脚本/mnq/测试2.js:14:0)
at /storage/emulated/0/脚本/mnq/测试2.js:6:0
版本
AJX:6.5.8
机型:小米10
安卓版本:13
此函数为了避免没有新截图可用造成的'卡住'改为反回上次的截图对象,所以每次反回的图片对象有概率是相同的
此lssue由于长期未活动已被自动关闭,如问题任然存在,请重新打开lssue