基于autojs的手机钉钉自动健康打卡脚本

//获取当前脚本的idvar 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() {        setTimeout(function() {            let m2 = text(mmArr[0]).findOne();            click(m2.bounds().centerX(), m2.bounds().centerY());        }, 500);        setTimeout(function() {            let m6 = text(mmArr[1]).findOne();            click(m6.bounds().centerX(), m6.bounds().centerY());        }, 1000);        setTimeout(function() {            let m2 = text(mmArr[2]).findOne();            click(m2.bounds().centerX(), m2.bounds().centerY());        }, 1500);        setTimeout(function() {            let m3 = text(mmArr[3]).findOne();            click(m3.bounds().centerX(), m3.bounds().centerY());        }, 2000);        if(mmArr.length == 6){            setTimeout(function() {                let m8 = text(mmArr[4]).findOne();                click(m8.bounds().centerX(), m8.bounds().centerY());            }, 2500);            setTimeout(function() {                let m0 = text(mmArr[5]).findOne();                click(m0.bounds().centerX(), m0.bounds().centerY());            }, 3000);        }        setTimeout(function() {            dddk();        }, 4000);    }, 3000);}else{    dddk();}//子线程打卡方法function dddk(){    var zxc = threads.start(function() {        // console.log("我们开始吧!!!");        app.launchApp("钉钉");        setTimeout(function() {            let theHome = id("home_bottom_tab_button_work").findOne(); //获取控件            //console.log(theHome.bounds().centerX());            click(theHome.bounds().centerX(), theHome.bounds().centerY()); //点击sias   //获取其中心位置并点击        }, 2000);        setTimeout(function() {            let ygjk = text("员工健康").findOne();            click(ygjk.bounds().centerX(), ygjk.bounds().centerY()); //点击员工健康        }, 5000);        setTimeout(function() {            let jt = text("今天").findOne();            click(jt.bounds().centerX(), jt.bounds().centerY()); //点击今天        }, 8000);        //不同学校的健康打卡,控件和流程可能有所不同,一般在获取位置和提交哪个先,还有上边员工健康的text值不同,对应修改即可。        setTimeout(function() {            let hqwz = text("获取").findOne();            click(hqwz.bounds().centerX(), hqwz.bounds().centerY()); //点击获取位置,        }, 11000);        setTimeout(function() {            swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150); //滚动            swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150);            swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150);            swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150);            swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150);            swipe(device.width * 0.8, device.height * 0.75, device.width * 0.8, device.height * 0.043, 150);        }, 13000);        setTimeout(function() {            let tj = text("提交").findOne();            click(tj.bounds().centerX(), tj.bounds().centerY()); //点击提交        }, 14200);    });}

来源:https://www.icode9.com/content-4-819851.html

(0)

相关推荐