基于autojs的手机钉钉健康打卡脚本 免root

原创脚本,转载请注明出处!!

//获取当前脚本的id
var current_e_id = engines.myEngine().id;
setTimeout(function() {
    //根据当前脚本id,获取当前脚本
    let to_terminate_e = engines.all().filter(e => current_e_id === e.id)[0];
    //    console.log("都结束了!!");
    setTimeout(function() {
        to_terminate_e.forceStop(); //结束当前脚本
    }, 2000);
}, 35000);

//判断屏幕是否亮屏,若未亮则解锁
if (!device.isScreenOn()) {
    let mima = "1234"; //密码
    let mmArr = mima.replace(/(.)(?=[^$])/g, "$1,").split(","); //字符串转字符数组
    device.wakeUp();
    setTimeout(function() {
        //console.show();
        swipe(device.width * 0.6, device.height * 0.78, device.width * 0.6, device.height * 0.3, 500);
    }, 1500);
    setTimeout(function() {
        for (let i = 0; i < mmArr.length; i++) {
            let m2 = text(mmArr[i]).findOne();
            sleep(100);
            click(m2.bounds().centerX(), m2.bounds().centerY());
        }
        sleep(800);
app.launchApp("Auto.js"); dddk(); },
3000); } else { dddk(); } function dddk() { var zxc = threads.start(function() { // console.log("我们开始吧!!!"); app.launchApp("钉钉"); let arrLC = ["home_bottom_tab_button_work", "员工健康", "今天", "获取", "提交"];//先判断流程,不同学校的控件文字或许有所不同,一般是"员工健康",若不同改为对应学校的text即可 let theClick = ""; //获取控件 for (let i = 0; i < arrLC.length; i++) { if(i == 0){ theClick = id(arrLC[i]).findOne(); //获取控件 }else if(i == arrLC.length - 1){//此处不同学校的打卡流程可能不同,此处为先获取位置再下滑。若是先下滑再获取位置,则改为,arrLC.length - 2即可 sleep(1000); for (let i = 0; i < 6; i++) { swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150); //滚动 } theClick = text(arrLC[i]).findOne(); //获取控件 }else{ theClick = text(arrLC[i]).findOne(); //获取控件 } sleep(500);//防止刷新延迟过程中出现未刷新完成的控件 click(theClick.bounds().centerX(), theClick.bounds().centerY()); //点击sias } }); }
原文地址:https://www.cnblogs.com/yzyBalance/p/14275273.html