[参考]AutoJS对QQ资料卡自动点赞脚本

本脚本可以在检测到QQ窗口的条件下对点赞控件进行操作。
基本技术为模拟点击
需要安装对应的AutoJS应用程序

var i = 1;

do {
    if (className("android.widget.TextView").text("联系人").exists()) {
        toast("命中 - 联系人匹配成功");
        if (className("android.widget.TextView").text("好友").exists()) {
            toast("命中 - 好友匹配成功");
            className("android.widget.TextView").text("好友").findOne().parent().click();
            do {
                if (id("rl").depth(12).className("android.widget.TextView").textEndsWith("联系人").exists()) {
                    toast("命中 - 截止条件匹配成功");
                    break;
                }
                if (className("android.widget.LinearLayout").exists()) {
                    var list = className("android.widget.LinearLayout").depth(11).untilFind();
                    toast("命中 - 好友框匹配成功");
                    /*
                    for (var i = 0; i < list.length; i++) {
                        //var bounds = list[i].bounds();
                        //console.log("检查 - list[" + i + "] = " + list[i]);
                        list[i].click();
                        for (var j = 0; j < 10; j++) {
                            className("android.widget.FrameLayout").id("l0b").click();
                        }
                        back();
                        //swipe(bounds.centerX(), bounds.Y(), bounds.centerX(), bounds.height());
                        sleep("2000");
                    }
                    */

                }
                toast("触发滚动");
                swipe(540, 1900, 540, 1000, 2000);
            } while (true)

        }
        break;
    }
    else {
        toast("等待切换到联系人页面[" + i + "/30]");
        sleep(5000);
        i++;
    }
} while (i <= 30);

posted @ 2021-09-28 10:00  二氢茉莉酮酸甲酯  阅读(650)  评论(0编辑  收藏  举报