About autojs timing stop instance source code

/*
*@More basics will not add autojs exchange group 553908361; copyright belongs to group friends
One-click add group: click to add group
// dark horse school script resource network Jiaoben.info More source code release
*
Insert picture description here
Insert picture description here
from the group Xiao Mengxin Put forward, group friends enthusiastically answer

run();
//实时显示脚本运行时长,并对返回的时长与设定的时长进行判断
function run() { //声明运行函数
    threads.start(function() {
        startTime = new Date().getTime();
    
        while (true) {
            runTime();
            sleep(1000);
        }
    });
}

function runTime() {
    var endTime = new Date().getTime();
    var spendTime = Math.floor((endTime - startTime) / 1000);
    log('已等待%d秒', spendTime);
    let t = 3;
    if (spendTime >= t) {
        console.info("定时已结束");
        exit();
    }
}

Guess you like

Origin blog.csdn.net/qq_30931547/article/details/112749299