您当前的位置: 首页 >  宴西笔记

Auto.js 找图防止泄漏

宴西笔记 发布时间:2022-07-30 11:57:25 ,浏览量:2

"ui";
ui.layout(
    
        
    
);
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

关注
打赏
1688896170
查看更多评论

宴西笔记

暂无认证

  • 2浏览

    0关注

    82博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0475s