Auto.js 实现钉钉实时抢红包
又到一年年会的环节了,每次都嫌自己手速慢?那就开挂本吧!
仅供学习使用,请勿传播:
测试下载地址:https://pan.baidu.com/s/1jradOvFF9-z53ycNaUd8MQ 密码:r8rh
使用方法APP里面有说明:
下面上最关键的核心代码:一下基于Auto.js pro 8实现!
toast("开启监听")
function tractHongBao() {
while (true) {
// sleep(50);
let chatView = id("list_view").findOnce();
if (chatView != null) {
for (let i = chatView.children().length - 1; i > 0; i--) {
let child = chatView.children()[i];
if (child != null) {
let targetP = child.findOne(id("chatting_content_view_stub"));
if (targetP != null && targetP.desc().startsWith("[红包]")) {
//需要再判断 是否领取过
let childs = targetP.children();
if (childs.length > 0) {
let readBaba = childs[0];
let papaInside = readBaba.children();
if (papaInside.length > 0) {
// console.log("对象===>>", papaInside);
let hasOpened = false;
papaInside.forEach(element => {
// console.log("孩子们", element.text());
if (element.text().endsWith('已领取')) {
hasOpened = true;
}
});
if (!hasOpened) {//没有打开过
targetP.click();
toastLog("还有谁");
witePopOpen();
}
}
}
}
}
}
}
}
}
function witePopOpen() {
let MaxWiteTime = 200;
while (MaxWiteTime > 0) {
let pickLay = id("rl_content").findOnce();
if (pickLay != null) {
click(pickLay.bounds().centerX(), pickLay.bounds().bottom - 250);
let backWite = 5;
let backBtn = descContains("返回").findOnce();
while (backBtn == null && backWite > 0) {
backBtn = descContains("返回").findOnce();
if (backBtn != null) {
backBtn.click();
break;
}
sleep(1000);
backWite--;
}
break;
}
sleep(100);
MaxWiteTime--;
}
}
events.on('exit', function (t) {
toastLog("退出监听");
});
tractHongBao();
如果对你有用请点个赞吧。如果有使用问题请留言!!!