"ui";
ui.layout(
<vertical>
<button id="开始"text="开始"/>
</vertical>
);
threads.start(function(){
requestScreenCapture();
})
ui.开始.click((a) => {
if (a.text() == "开始") {
a.setText("结束")
//开线程
threads.start(function() {
while (true) {
找图()
}
})
return;
}
a.setText("开始")
threads.shutDownAll() //关闭所有线程
回收所有图片()
})
let t = {}
function 找图() {
t.名字 = images.read("/storage/emulated/0/脚本/Aj图片/1658990898251.png");
let img=captureScreen();
let p = images.findImage(img, t.名字); //找图
if(p){
toastLog("找到")
}else {
toastLog("没找到")
}
sleep(3000)
t.名字.recycle()
}
function 回收所有图片() {
for (let i in t) {
if (i) {
t[i].recycle()
}
}
}
QQ群 568523841