├── README.md ├── js ├── 杀内存.js ├── gms开关.js ├── 番茄免费小说.js ├── 蛋花免费小说.js ├── 常读免费小说.js ├── 京东.js ├── 快手极速版.js ├── 佣金帝.js ├── 番茄畅听.js ├── 木叶免费短剧.js ├── 红果免费短剧.js ├── tools.js ├── 网上国网.js └── 新氧.js └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # wool 2 | 3 | #### 基于autojs的薅羊毛脚本集合,随心情更新。 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /js/杀内存.js: -------------------------------------------------------------------------------- 1 | APP_name = "内存杀手"; 2 | Package_name = getPackageName(APP_name); 3 | 4 | 5 | 6 | //黑阈临时启动 7 | function start(Package_name) { 8 | home(); 9 | sleep(500); 10 | text("执行指令").findOne().click(); 11 | id("command").setText("launch-instant " + Package_name); 12 | sleep(600); 13 | id("exec").findOne().click(); 14 | } 15 | 16 | 17 | 18 | function stop(Package_name) { 19 | var sh = new Shell(true); 20 | sh.exec("am force-stop " + Package_name); 21 | sleep(1000); 22 | sh.exit; 23 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 24 | } 25 | 26 | function handle() { 27 | start(Package_name); 28 | id("button").findOne().click(); 29 | sleep(58*1000); 30 | stop(Package_name); 31 | } 32 | 33 | handle() -------------------------------------------------------------------------------- /js/gms开关.js: -------------------------------------------------------------------------------- 1 | //Root方式的版本 2 | function requestRoot() { 3 | // 使用Java的Runtime执行su命令 4 | var process = java.lang.Runtime.getRuntime().exec("su"); 5 | var outputStream = new java.io.DataOutputStream(process.getOutputStream()); 6 | 7 | // 执行需要Root权限的命令 8 | outputStream.writeBytes("pm disable-user " + Package_name + "\n"); 9 | outputStream.writeBytes("pm enable " + Package_name + "\n"); 10 | outputStream.writeBytes("exit\n"); 11 | outputStream.flush(); 12 | process.waitFor(); 13 | 14 | 15 | 16 | // 应用停用/启用切换,修改APP_name即可 17 | var APP_name = "Google Play 服务"; 18 | var Package_name = getPackageName(APP_name); 19 | 20 | // shell环境执行 21 | function start() { 22 | var sh = new Shell(true); 23 | 24 | // 获取pid进程 25 | var cmd = "pidof " + Package_name; 26 | var flag = shell(cmd, true).result; 27 | 28 | // 停用/启用 29 | if (flag !== "") { 30 | sh.exec("pm disable-user " + Package_name); 31 | toastLog(APP_name + "已停用"); 32 | } else { 33 | sh.exec("pm enable " + Package_name); 34 | toastLog(APP_name + "已启用"); 35 | } 36 | 37 | sleep(1000); 38 | 39 | sh.exit; 40 | } 41 | 42 | start(); 43 | } 44 | 45 | // 请求Root权限 46 | requestRoot(); -------------------------------------------------------------------------------- /js/番茄免费小说.js: -------------------------------------------------------------------------------- 1 | //耗时约3小时;v59332 2 | APP_name = "番茄免费小说"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | //黑阈临时启动APP 6 | function start() { 7 | home(); 8 | sleep(500); 9 | clickNonClickable("执行指令",5,600); 10 | id("command").setText("launch-instant " + Package_name); 11 | sleep(800); 12 | clickNonClickable("#exec",5,600); 13 | } 14 | 15 | //常规启动 16 | function start0() { 17 | launch(getPackageName(APP_name)); 18 | var sh = new Shell(true); 19 | return sh; 20 | } 21 | 22 | function stop() { 23 | var sh = new Shell(true); 24 | sh.exec("am force-stop " + Package_name); 25 | sleep(1000); 26 | sh.exit; 27 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 28 | } 29 | 30 | //点击text/id;单个/首个目标 31 | function clickNonClickable(selector, maxRetries, retryDelay) { 32 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 33 | var target = null; 34 | 35 | if (selector.startsWith("#")) { 36 | // 如果选择器以"#"开头,表示使用id 37 | target = id(selector.substring(1)).findOne(); 38 | } else { 39 | // 否则,默认使用text 40 | target = text(selector).findOne(); 41 | } 42 | 43 | if (target) { 44 | // 尝试直接使用click函数点击目标控件 45 | if (target.clickable()) { 46 | target.click(); 47 | return; 48 | } else { 49 | // 如果clickable属性为false,尝试使用坐标点击 50 | var centerX = target.bounds().centerX(); 51 | var centerY = target.bounds().centerY(); 52 | 53 | click(centerX, centerY); 54 | return; 55 | } 56 | } else { 57 | sleep(retryDelay); 58 | } 59 | } 60 | toast("达到最大重试次数,点击" + selector + "失败"); 61 | } 62 | //点击第n个text/id;可超时 63 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 64 | var foundCount = 0; 65 | 66 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 67 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 68 | if (targets.length > 0) { 69 | // 检查是否存在足够的匹配项 70 | if (foundCount + targets.length >= n) { 71 | // 找到第n个匹配项 72 | var targetIndex = n - foundCount - 1; 73 | var target = targets[targetIndex]; 74 | 75 | // 尝试直接使用click函数点击目标控件 76 | if (target.clickable()) { 77 | target.click(); 78 | foundCount++; 79 | return; 80 | } else { 81 | // 如果clickable属性为false,尝试使用坐标点击 82 | var centerX = target.bounds().centerX(); 83 | var centerY = target.bounds().centerY(); 84 | 85 | click(centerX, centerY); 86 | foundCount++; 87 | return; 88 | } 89 | } else { 90 | // 增加已找到的计数 91 | foundCount += targets.length; 92 | } 93 | } else { 94 | sleep(retryDelay); 95 | } 96 | } 97 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 98 | } 99 | 100 | function FloatingCurrentAPP() { 101 | sleep(500); 102 | // 打开多任务视图 103 | recents(); 104 | desc("更多").findOne().click(); 105 | sleep(150); 106 | click("浮窗"); 107 | } 108 | 109 | 110 | function handle() { 111 | id("v4").waitFor(); 112 | sleep(2900); 113 | if (text("继续听").exists()) { 114 | clickNonClickable("继续听", 2, 500); 115 | } else { 116 | clickNonClickable("继续阅读", 3, 500); 117 | className("android.widget.FrameLayout").clickable(true).depth(10).findOne().click() 118 | } 119 | id("d0b").findOne().click(); 120 | sleep(500); 121 | click(device.width / 2, device.height / 2); 122 | FloatingCurrentAPP(); 123 | sleep(3 * 3660 * 1000); 124 | 125 | } 126 | 127 | start1 = start0() 128 | handle() 129 | stop() -------------------------------------------------------------------------------- /js/蛋花免费小说.js: -------------------------------------------------------------------------------- 1 | //耗时约3小时 2 | APP_name = "蛋花免费小说"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | //黑阈临时启动APP 6 | function start() { 7 | home(); 8 | sleep(500); 9 | clickNonClickable("执行指令",5,600); 10 | id("command").setText("launch-instant " + Package_name); 11 | sleep(800); 12 | clickNonClickable("#exec",5,600); 13 | } 14 | 15 | //常规启动 16 | function start0() { 17 | launch(getPackageName(APP_name)); 18 | var sh = new Shell(true); 19 | return sh; 20 | } 21 | 22 | function stop() { 23 | var sh = new Shell(true); 24 | sh.exec("am force-stop " + Package_name); 25 | sleep(1000); 26 | sh.exit; 27 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 28 | } 29 | 30 | //点击text/id;单个/首个目标 31 | function clickNonClickable(selector, maxRetries, retryDelay) { 32 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 33 | var target = null; 34 | 35 | if (selector.startsWith("#")) { 36 | // 如果选择器以"#"开头,表示使用id 37 | target = id(selector.substring(1)).findOne(); 38 | } else { 39 | // 否则,默认使用text 40 | target = text(selector).findOne(); 41 | } 42 | 43 | if (target) { 44 | // 尝试直接使用click函数点击目标控件 45 | if (target.clickable()) { 46 | target.click(); 47 | return; 48 | } else { 49 | // 如果clickable属性为false,尝试使用坐标点击 50 | var centerX = target.bounds().centerX(); 51 | var centerY = target.bounds().centerY(); 52 | 53 | click(centerX, centerY); 54 | return; 55 | } 56 | } else { 57 | sleep(retryDelay); 58 | } 59 | } 60 | toast("达到最大重试次数,点击" + selector + "失败"); 61 | } 62 | 63 | //点击第n个text/id;可超时 64 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 65 | var foundCount = 0; 66 | 67 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 68 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 69 | if (targets.length > 0) { 70 | // 检查是否存在足够的匹配项 71 | if (foundCount + targets.length >= n) { 72 | // 找到第n个匹配项 73 | var targetIndex = n - foundCount - 1; 74 | var target = targets[targetIndex]; 75 | 76 | // 尝试直接使用click函数点击目标控件 77 | if (target.clickable()) { 78 | target.click(); 79 | foundCount++; 80 | return; 81 | } else { 82 | // 如果clickable属性为false,尝试使用坐标点击 83 | var centerX = target.bounds().centerX(); 84 | var centerY = target.bounds().centerY(); 85 | 86 | click(centerX, centerY); 87 | foundCount++; 88 | return; 89 | } 90 | } else { 91 | // 增加已找到的计数 92 | foundCount += targets.length; 93 | } 94 | } else { 95 | sleep(retryDelay); 96 | } 97 | } 98 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 99 | } 100 | //浮窗当前APP 101 | function FloatingCurrentAPP() { 102 | sleep(500); 103 | // 打开多任务视图 104 | recents(); 105 | desc("更多").findOne().click(); 106 | sleep(150); 107 | click("浮窗"); 108 | } 109 | 110 | 111 | function handle() { 112 | sleep(3800); 113 | if (id("cbl").exists()) { 114 | className("android.widget.FrameLayout").clickable(true).depth(10).findOne().click() 115 | } else { 116 | id("aeh").waitFor(); 117 | sleep(100); 118 | if (text("继续听").exists()) { 119 | clickNonClickable("继续听", 2, 500); 120 | } else { 121 | clickNonClickable("继续阅读", 3, 500); 122 | className("android.widget.FrameLayout").clickable(true).depth(10).findOne().click() 123 | 124 | } 125 | } 126 | id("d0e").findOne().click(); 127 | sleep(5000); 128 | click(device.width / 2, device.height / 2); 129 | FloatingCurrentAPP(); 130 | sleep(3 * 3660 * 1000); 131 | 132 | 133 | } 134 | 135 | start1 = start0() 136 | handle() 137 | stop() -------------------------------------------------------------------------------- /js/常读免费小说.js: -------------------------------------------------------------------------------- 1 | //耗时约3小时 2 | APP_name = "常读免费小说"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | 6 | //黑阈临时启动APP 7 | function start() { 8 | home(); 9 | sleep(500); 10 | home(); 11 | sleep(500); 12 | text("执行指令").findOne().click(); 13 | id("command").setText("launch-instant " + Package_name); 14 | sleep(600); 15 | id("exec").findOne().click(); 16 | } 17 | 18 | //常规启动 19 | function start0() { 20 | launch(getPackageName(APP_name)); 21 | var sh = new Shell(true); 22 | return sh; 23 | } 24 | 25 | function stop() { 26 | var sh = new Shell(true); 27 | sh.exec("am force-stop " + Package_name); 28 | sleep(1000); 29 | sh.exit; 30 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 31 | } 32 | 33 | //点击text/id;单个/首个目标 34 | function clickNonClickable(selector, maxRetries, retryDelay) { 35 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 36 | var target = null; 37 | 38 | if (selector.startsWith("#")) { 39 | // 如果选择器以"#"开头,表示使用id 40 | target = id(selector.substring(1)).findOne(); 41 | } else { 42 | // 否则,默认使用text 43 | target = text(selector).findOne(); 44 | } 45 | 46 | if (target) { 47 | // 尝试直接使用click函数点击目标控件 48 | if (target.clickable()) { 49 | target.click(); 50 | return; 51 | } else { 52 | // 如果clickable属性为false,尝试使用坐标点击 53 | var centerX = target.bounds().centerX(); 54 | var centerY = target.bounds().centerY(); 55 | 56 | click(centerX, centerY); 57 | return; 58 | } 59 | } else { 60 | sleep(retryDelay); 61 | } 62 | } 63 | toast("达到最大重试次数,点击" + selector + "失败"); 64 | } 65 | 66 | //点击第n个text/id;可超时 67 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 68 | var foundCount = 0; 69 | 70 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 71 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 72 | if (targets.length > 0) { 73 | // 检查是否存在足够的匹配项 74 | if (foundCount + targets.length >= n) { 75 | // 找到第n个匹配项 76 | var targetIndex = n - foundCount - 1; 77 | var target = targets[targetIndex]; 78 | 79 | // 尝试直接使用click函数点击目标控件 80 | if (target.clickable()) { 81 | target.click(); 82 | foundCount++; 83 | return; 84 | } else { 85 | // 如果clickable属性为false,尝试使用坐标点击 86 | var centerX = target.bounds().centerX(); 87 | var centerY = target.bounds().centerY(); 88 | 89 | click(centerX, centerY); 90 | foundCount++; 91 | return; 92 | } 93 | } else { 94 | // 增加已找到的计数 95 | foundCount += targets.length; 96 | } 97 | } else { 98 | sleep(retryDelay); 99 | } 100 | } 101 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 102 | } 103 | 104 | 105 | 106 | //浮窗当前APP 107 | function FloatingCurrentAPP() { 108 | sleep(500); 109 | // 打开多任务视图 110 | recents(); 111 | sleep(600); 112 | //desc("更多").findOne().click();///coloros15不适用 113 | Tap(795,285); 114 | sleep(150); 115 | click("浮窗"); 116 | } 117 | 118 | 119 | function handle() { 120 | sleep(4100); 121 | if(className("android.widget.FrameLayout").clickable(true).depth(10).exists()){ className("android.widget.FrameLayout").clickable(true).depth(10).findOne().click() 122 | } else { 123 | id("y3").waitFor(); 124 | sleep(100); 125 | if (text("继续听").exists()) { 126 | clickNonClickable("继续听", 2, 500); 127 | } else { 128 | clickNonClickable("继续阅读", 2, 500); 129 | className("android.widget.FrameLayout").clickable(true).depth(10).findOne().click() 130 | } 131 | } 132 | id("dct").findOne().click(); 133 | sleep(2500); 134 | click(device.width / 2, device.height / 2); 135 | FloatingCurrentAPP(); 136 | sleep(3 * 3660 * 1000); 137 | 138 | } 139 | 140 | start1 = start() 141 | handle() 142 | stop() -------------------------------------------------------------------------------- /js/京东.js: -------------------------------------------------------------------------------- 1 | //耗时20-33分钟 2 | APP_name = "京东"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | 6 | //黑阈临时启动APP 7 | function start() { 8 | home(); 9 | sleep(500); 10 | clickNonClickable("执行指令",5,600); 11 | id("command").setText("launch-instant " + Package_name); 12 | sleep(800); 13 | clickNonClickable("#exec",5,600); 14 | } 15 | 16 | //常规启动APP 17 | function start0() { 18 | launch(getPackageName(APP_name)); 19 | var sh = new Shell(true); 20 | return sh; 21 | } 22 | 23 | //退出APP 24 | function stop() { 25 | launch(getPackageName(APP_name)); 26 | var sh = new Shell(true); 27 | sh.exec("am force-stop " + Package_name); 28 | sleep(1000); 29 | sh.exit; 30 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 31 | } 32 | 33 | //点击text/id;单个/首个目标 34 | function clickNonClickable(selector, maxRetries, retryDelay) { 35 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 36 | var target = null; 37 | 38 | if (selector.startsWith("#")) { 39 | // 如果选择器以"#"开头,表示使用id 40 | target = id(selector.substring(1)).findOne(); 41 | } else { 42 | // 否则,默认使用text 43 | target = text(selector).findOne(); 44 | } 45 | 46 | if (target) { 47 | // 尝试直接使用click函数点击目标控件 48 | if (target.clickable()) { 49 | target.click(); 50 | return; 51 | } else { 52 | // 如果clickable属性为false,尝试使用坐标点击 53 | var centerX = target.bounds().centerX(); 54 | var centerY = target.bounds().centerY(); 55 | 56 | click(centerX, centerY); 57 | return; 58 | } 59 | } else { 60 | sleep(retryDelay); 61 | } 62 | } 63 | toast("达到最大重试次数,点击" + selector + "失败"); 64 | } 65 | 66 | //点击置顶层text/id 67 | function clickToplayer(selector) { 68 | // 通过元素识别方法获取目标按钮的坐标 69 | var targetElement = null; 70 | 71 | if (selector.startsWith("#")) { 72 | // 如果选择器以"#"开头,表示使用id 73 | targetElement = id(selector.substring(1)).findOne(); 74 | } else { 75 | // 否则,默认使用text 76 | targetElement = text(selector).findOne(); 77 | } 78 | 79 | if (!targetElement) { 80 | toast("未找到目标元素:" + selector); 81 | return false; 82 | } 83 | 84 | // 获取目标元素的坐标 85 | var targetX = targetElement.bounds().centerX(); 86 | var targetY = targetElement.bounds().centerY(); 87 | 88 | // 模拟点击目标元素 89 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 90 | return true; 91 | } 92 | 93 | //Tap/click/press:坐标bounds(适应分辨率) 94 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 95 | // 解析传入的bounds字符串 96 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 97 | var match = boundsString.match(regex); 98 | 99 | if (!match) { 100 | console.error("传入的bounds格式不正确"); 101 | return; 102 | } 103 | 104 | // 获取设备宽度和高度 105 | var screenWidth = device.width; 106 | var screenHeight = device.height; 107 | 108 | // 计算目标区域的中心点坐标 109 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 110 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 111 | var right = parseInt(match[3]) * screenWidth / 1080; 112 | var bottom = parseInt(match[4]) * screenHeight / 2400; 113 | 114 | var centerX = (left + right) / 2; 115 | var centerY = (top + bottom) / 2; 116 | 117 | // 输出调试信息 118 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 119 | 120 | // 使用click函数点击目标区域的中心点 121 | click(centerX, centerY); 122 | } 123 | 124 | //点击第n个text/id;可超时 125 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 126 | var foundCount = 0; 127 | 128 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 129 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 130 | if (targets.length > 0) { 131 | // 检查是否存在足够的匹配项 132 | if (foundCount + targets.length >= n) { 133 | // 找到第n个匹配项 134 | var targetIndex = n - foundCount - 1; 135 | var target = targets[targetIndex]; 136 | 137 | // 尝试直接使用click函数点击目标控件 138 | if (target.clickable()) { 139 | target.click(); 140 | foundCount++; 141 | return; 142 | } else { 143 | // 如果clickable属性为false,尝试使用坐标点击 144 | var centerX = target.bounds().centerX(); 145 | var centerY = target.bounds().centerY(); 146 | 147 | click(centerX, centerY); 148 | foundCount++; 149 | return; 150 | } 151 | } else { 152 | // 增加已找到的计数 153 | foundCount += targets.length; 154 | } 155 | } else { 156 | sleep(retryDelay); 157 | } 158 | } 159 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 160 | } 161 | 162 | //刷视频 163 | function BrushVideos(a,b){ 164 | for (var i = 0; i < random(a, b); i++) { 165 | // 生成随机坐标和滑动时间 166 | var startX = random(800/1440*device.width, 1100/1440*device.width); 167 | var startY = random(2210/3168*device.height, 2399/3168*device.height); 168 | var endX = random(900/1440*device.width, 1020/1440*device.width); 169 | var endY = random(200/3168*device.height, 399/3168*device.height); 170 | var duration = random(420, 720); 171 | 172 | swipe(startX, startY, endX, endY, duration); 173 | toastLog(APP_name + "计数器:" + (i + 1)); 174 | // 生成2.6到8.7之间的随机数 175 | sleep(random(2600, 8700)); 176 | } 177 | } 178 | 179 | 180 | function handle() { 181 | sleep(3700); 182 | clickNonClickable("逛", 3, 500); 183 | sleep(4300); 184 | BrushVideos(269, 369); 185 | } 186 | 187 | start1 = start() 188 | handle() 189 | stop() 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /js/快手极速版.js: -------------------------------------------------------------------------------- 1 | //耗时20分钟 2 | APP_name = "快手极速版"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | //黑阈临时启动APP 6 | function start() { 7 | home(); 8 | sleep(500); 9 | home(); 10 | sleep(500); 11 | text("执行指令").findOne().click(); 12 | id("command").setText("launch-instant " + Package_name); 13 | sleep(600); 14 | id("exec").findOne().click(); 15 | } 16 | 17 | //常规启动APP 18 | function start0() { 19 | launch(getPackageName(APP_name)); 20 | var sh = new Shell(true); 21 | return sh; 22 | } 23 | 24 | //退出APP 25 | function stop() { 26 | launch(getPackageName(APP_name)); 27 | var sh = new Shell(true); 28 | sh.exec("am force-stop " + Package_name); 29 | sleep(1000); 30 | sh.exit; 31 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 32 | } 33 | 34 | //点击text/id;单个/首个目标 35 | function clickNonClickable(selector, maxRetries, retryDelay) { 36 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 37 | var target = null; 38 | 39 | if (selector.startsWith("#")) { 40 | // 如果选择器以"#"开头,表示使用id 41 | target = id(selector.substring(1)).findOne(); 42 | } else { 43 | // 否则,默认使用text 44 | target = text(selector).findOne(); 45 | } 46 | 47 | if (target) { 48 | // 尝试直接使用click函数点击目标控件 49 | if (target.clickable()) { 50 | target.click(); 51 | return; 52 | } else { 53 | // 如果clickable属性为false,尝试使用坐标点击 54 | var centerX = target.bounds().centerX(); 55 | var centerY = target.bounds().centerY(); 56 | 57 | click(centerX, centerY); 58 | return; 59 | } 60 | } else { 61 | sleep(retryDelay); 62 | } 63 | } 64 | toast("达到最大重试次数,点击" + selector + "失败"); 65 | } 66 | 67 | //点击置顶层text/id 68 | function clickToplayer(selector) { 69 | // 通过元素识别方法获取目标按钮的坐标 70 | var targetElement = null; 71 | 72 | if (selector.startsWith("#")) { 73 | // 如果选择器以"#"开头,表示使用id 74 | targetElement = id(selector.substring(1)).findOne(); 75 | } else { 76 | // 否则,默认使用text 77 | targetElement = text(selector).findOne(); 78 | } 79 | 80 | if (!targetElement) { 81 | toast("未找到目标元素:" + selector); 82 | return false; 83 | } 84 | 85 | // 获取目标元素的坐标 86 | var targetX = targetElement.bounds().centerX(); 87 | var targetY = targetElement.bounds().centerY(); 88 | 89 | // 模拟点击目标元素 90 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 91 | return true; 92 | } 93 | 94 | //Tap/click/press:坐标bounds(适应分辨率) 95 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 96 | // 解析传入的bounds字符串 97 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 98 | var match = boundsString.match(regex); 99 | 100 | if (!match) { 101 | console.error("传入的bounds格式不正确"); 102 | return; 103 | } 104 | 105 | // 获取设备宽度和高度 106 | var screenWidth = device.width; 107 | var screenHeight = device.height; 108 | 109 | // 计算目标区域的中心点坐标 110 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 111 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 112 | var right = parseInt(match[3]) * screenWidth / 1080; 113 | var bottom = parseInt(match[4]) * screenHeight / 2400; 114 | 115 | var centerX = (left + right) / 2; 116 | var centerY = (top + bottom) / 2; 117 | 118 | // 输出调试信息 119 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 120 | 121 | // 使用click函数点击目标区域的中心点 122 | click(centerX, centerY); 123 | } 124 | 125 | //点击第n个text/id;可超时 126 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 127 | var foundCount = 0; 128 | 129 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 130 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 131 | if (targets.length > 0) { 132 | // 检查是否存在足够的匹配项 133 | if (foundCount + targets.length >= n) { 134 | // 找到第n个匹配项 135 | var targetIndex = n - foundCount - 1; 136 | var target = targets[targetIndex]; 137 | 138 | // 尝试直接使用click函数点击目标控件 139 | if (target.clickable()) { 140 | target.click(); 141 | foundCount++; 142 | return; 143 | } else { 144 | // 如果clickable属性为false,尝试使用坐标点击 145 | var centerX = target.bounds().centerX(); 146 | var centerY = target.bounds().centerY(); 147 | 148 | click(centerX, centerY); 149 | foundCount++; 150 | return; 151 | } 152 | } else { 153 | // 增加已找到的计数 154 | foundCount += targets.length; 155 | } 156 | } else { 157 | sleep(retryDelay); 158 | } 159 | } 160 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 161 | } 162 | 163 | //刷视频 164 | function BrushVideos(a,b){ 165 | for (var i = 0; i < random(a, b); i++) { 166 | // 生成随机坐标和滑动时间 167 | var startX = random(800/1440*device.width, 1100/1440*device.width); 168 | var startY = random(2210/3168*device.height, 2399/3168*device.height); 169 | var endX = random(900/1440*device.width, 1020/1440*device.width); 170 | var endY = random(200/3168*device.height, 399/3168*device.height); 171 | var duration = random(420, 720); 172 | 173 | swipe(startX, startY, endX, endY, duration); 174 | toastLog(APP_name + "计数器:" + (i + 1)); 175 | // 生成2.6到8.7之间的随机数 176 | sleep(random(2600, 8700)); 177 | } 178 | } 179 | 180 | 181 | 182 | 183 | 184 | function handle() { 185 | clickNonClickable("首页", 3, 500); 186 | sleep(3900); 187 | BrushVideos(241, 369); 188 | } 189 | 190 | start1 = start() 191 | handle() 192 | stop() 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /js/佣金帝.js: -------------------------------------------------------------------------------- 1 | //耗时忽略 2 | APP_name = "佣金帝"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | 6 | //黑阈临时启动APP 7 | function start() { 8 | home(); 9 | sleep(500); 10 | clickNonClickable("执行指令",5,600); 11 | id("command").setText("launch-instant " + Package_name); 12 | sleep(800); 13 | clickNonClickable("#exec",5,600); 14 | } 15 | 16 | //常规启动APP 17 | function start0() { 18 | launch(getPackageName(APP_name)); 19 | var sh = new Shell(true); 20 | return sh; 21 | } 22 | 23 | //退出APP 24 | function stop() { 25 | launch(getPackageName(APP_name)); 26 | var sh = new Shell(true); 27 | sh.exec("am force-stop " + Package_name); 28 | sleep(1000); 29 | sh.exit; 30 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 31 | } 32 | 33 | //点击text/id;单个/首个目标 34 | function clickNonClickable(selector, maxRetries, retryDelay) { 35 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 36 | var target = null; 37 | 38 | if (selector.startsWith("#")) { 39 | // 如果选择器以"#"开头,表示使用id 40 | target = id(selector.substring(1)).findOne(); 41 | } else { 42 | // 否则,默认使用text 43 | target = text(selector).findOne(); 44 | } 45 | 46 | if (target) { 47 | // 尝试直接使用click函数点击目标控件 48 | if (target.clickable()) { 49 | target.click(); 50 | return; 51 | } else { 52 | // 如果clickable属性为false,尝试使用坐标点击 53 | var centerX = target.bounds().centerX(); 54 | var centerY = target.bounds().centerY(); 55 | 56 | click(centerX, centerY); 57 | return; 58 | } 59 | } else { 60 | sleep(retryDelay); 61 | } 62 | } 63 | toast("达到最大重试次数,点击" + selector + "失败"); 64 | } 65 | 66 | //点击置顶层text/id 67 | function clickToplayer(selector) { 68 | // 通过元素识别方法获取目标按钮的坐标 69 | var targetElement = null; 70 | 71 | if (selector.startsWith("#")) { 72 | // 如果选择器以"#"开头,表示使用id 73 | targetElement = id(selector.substring(1)).findOne(); 74 | } else { 75 | // 否则,默认使用text 76 | targetElement = text(selector).findOne(); 77 | } 78 | 79 | if (!targetElement) { 80 | toast("未找到目标元素:" + selector); 81 | return false; 82 | } 83 | 84 | // 获取目标元素的坐标 85 | var targetX = targetElement.bounds().centerX(); 86 | var targetY = targetElement.bounds().centerY(); 87 | 88 | // 模拟点击目标元素 89 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 90 | return true; 91 | } 92 | 93 | //Tap/click/press:坐标bounds(适应分辨率) 94 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 95 | // 解析传入的bounds字符串 96 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 97 | var match = boundsString.match(regex); 98 | 99 | if (!match) { 100 | console.error("传入的bounds格式不正确"); 101 | return; 102 | } 103 | 104 | // 获取设备宽度和高度 105 | var screenWidth = device.width; 106 | var screenHeight = device.height; 107 | 108 | // 计算目标区域的中心点坐标 109 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 110 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 111 | var right = parseInt(match[3]) * screenWidth / 1080; 112 | var bottom = parseInt(match[4]) * screenHeight / 2400; 113 | 114 | var centerX = (left + right) / 2; 115 | var centerY = (top + bottom) / 2; 116 | 117 | // 输出调试信息 118 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 119 | 120 | // 使用click函数点击目标区域的中心点 121 | click(centerX, centerY); 122 | } 123 | 124 | //点击第n个text/id;可超时 125 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 126 | var foundCount = 0; 127 | 128 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 129 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 130 | if (targets.length > 0) { 131 | // 检查是否存在足够的匹配项 132 | if (foundCount + targets.length >= n) { 133 | // 找到第n个匹配项 134 | var targetIndex = n - foundCount - 1; 135 | var target = targets[targetIndex]; 136 | 137 | // 尝试直接使用click函数点击目标控件 138 | if (target.clickable()) { 139 | target.click(); 140 | foundCount++; 141 | return; 142 | } else { 143 | // 如果clickable属性为false,尝试使用坐标点击 144 | var centerX = target.bounds().centerX(); 145 | var centerY = target.bounds().centerY(); 146 | 147 | click(centerX, centerY); 148 | foundCount++; 149 | return; 150 | } 151 | } else { 152 | // 增加已找到的计数 153 | foundCount += targets.length; 154 | } 155 | } else { 156 | sleep(retryDelay); 157 | } 158 | } 159 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 160 | } 161 | 162 | //刷视频 163 | function BrushVideos(a, b) { 164 | for (var i = 0; i < random(a, b); i++) { 165 | // 生成随机坐标和滑动时间 166 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 167 | var startY = random(2210 / 3168 * device.height, 2399 / 3168 * device.height); 168 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 169 | var endY = random(200 / 3168 * device.height, 399 / 3168 * device.height); 170 | var duration = random(420, 720); 171 | 172 | swipe(startX, startY, endX, endY, duration); 173 | toastLog(APP_name + "计数器:" + (i + 1)); 174 | // 生成2.6到8.7之间的随机数 175 | sleep(random(2600, 8700)); 176 | } 177 | } 178 | 179 | function handle() { 180 | clickNonClickable("签到赚钱", 3, 500); 181 | sleep(8500); 182 | //if (text("立即签到 +30 ").exists()) { 183 | // clickNonClickable("立即签到 +30 ", 3, 500); 184 | //} 185 | click("立即签到"); 186 | sleep(2500); 187 | } 188 | 189 | start1 = start() 190 | handle() 191 | stop() -------------------------------------------------------------------------------- /js/番茄畅听.js: -------------------------------------------------------------------------------- 1 | //耗时0 2 | APP_name = "番茄畅听"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | 6 | //黑阈临时启动APP 7 | function start() { 8 | home(); 9 | sleep(500); 10 | home(); 11 | sleep(500); 12 | text("执行指令").findOne().click(); 13 | id("command").setText("launch-instant " + Package_name); 14 | sleep(600); 15 | id("exec").findOne().click(); 16 | } 17 | 18 | //常规启动APP 19 | function start0() { 20 | launch(getPackageName(APP_name)); 21 | var sh = new Shell(true); 22 | return sh; 23 | } 24 | 25 | //退出APP 26 | function stop() { 27 | launch(getPackageName(APP_name)); 28 | var sh = new Shell(true); 29 | sh.exec("am force-stop " + Package_name); 30 | sleep(1000); 31 | sh.exit; 32 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 33 | } 34 | 35 | //点击text/id;单个/首个目标 36 | function clickNonClickable(selector, maxRetries, retryDelay) { 37 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 38 | var target = null; 39 | 40 | if (selector.startsWith("#")) { 41 | // 如果选择器以"#"开头,表示使用id 42 | target = id(selector.substring(1)).findOne(); 43 | } else { 44 | // 否则,默认使用text 45 | target = text(selector).findOne(); 46 | } 47 | 48 | if (target) { 49 | // 尝试直接使用click函数点击目标控件 50 | if (target.clickable()) { 51 | target.click(); 52 | return; 53 | } else { 54 | // 如果clickable属性为false,尝试使用坐标点击 55 | var centerX = target.bounds().centerX(); 56 | var centerY = target.bounds().centerY(); 57 | 58 | click(centerX, centerY); 59 | return; 60 | } 61 | } else { 62 | sleep(retryDelay); 63 | } 64 | } 65 | toast("达到最大重试次数,点击" + selector + "失败"); 66 | } 67 | 68 | //点击置顶层text/id 69 | function clickToplayer(selector) { 70 | // 通过元素识别方法获取目标按钮的坐标 71 | var targetElement = null; 72 | 73 | if (selector.startsWith("#")) { 74 | // 如果选择器以"#"开头,表示使用id 75 | targetElement = id(selector.substring(1)).findOne(); 76 | } else { 77 | // 否则,默认使用text 78 | targetElement = text(selector).findOne(); 79 | } 80 | 81 | if (!targetElement) { 82 | toast("未找到目标元素:" + selector); 83 | return false; 84 | } 85 | 86 | // 获取目标元素的坐标 87 | var targetX = targetElement.bounds().centerX(); 88 | var targetY = targetElement.bounds().centerY(); 89 | 90 | // 模拟点击目标元素 91 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 92 | return true; 93 | } 94 | 95 | //Tap/click/press:坐标bounds(适应分辨率) 96 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 97 | // 解析传入的bounds字符串 98 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 99 | var match = boundsString.match(regex); 100 | 101 | if (!match) { 102 | console.error("传入的bounds格式不正确"); 103 | return; 104 | } 105 | 106 | // 获取设备宽度和高度 107 | var screenWidth = device.width; 108 | var screenHeight = device.height; 109 | 110 | // 计算目标区域的中心点坐标 111 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 112 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 113 | var right = parseInt(match[3]) * screenWidth / 1080; 114 | var bottom = parseInt(match[4]) * screenHeight / 2400; 115 | 116 | var centerX = (left + right) / 2; 117 | var centerY = (top + bottom) / 2; 118 | 119 | // 输出调试信息 120 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 121 | 122 | // 使用click函数点击目标区域的中心点 123 | click(centerX, centerY); 124 | } 125 | 126 | //点击第n个text/id;可超时 127 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 128 | var foundCount = 0; 129 | 130 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 131 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 132 | if (targets.length > 0) { 133 | // 检查是否存在足够的匹配项 134 | if (foundCount + targets.length >= n) { 135 | // 找到第n个匹配项 136 | var targetIndex = n - foundCount - 1; 137 | var target = targets[targetIndex]; 138 | 139 | // 尝试直接使用click函数点击目标控件 140 | if (target.clickable()) { 141 | target.click(); 142 | foundCount++; 143 | return; 144 | } else { 145 | // 如果clickable属性为false,尝试使用坐标点击 146 | var centerX = target.bounds().centerX(); 147 | var centerY = target.bounds().centerY(); 148 | 149 | click(centerX, centerY); 150 | foundCount++; 151 | return; 152 | } 153 | } else { 154 | // 增加已找到的计数 155 | foundCount += targets.length; 156 | } 157 | } else { 158 | sleep(retryDelay); 159 | } 160 | } 161 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 162 | } 163 | 164 | //刷视频 165 | function BrushVideos(a, b) { 166 | for (var i = 0; i < random(a, b); i++) { 167 | // 生成随机坐标和滑动时间 168 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 169 | var startY = random(2300 / 3168 * device.height, 2500 / 3168 * device.height); 170 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 171 | var endY = random(200 / 3168 * device.height, 350 / 3168 * device.height); 172 | var duration = random(420, 720); 173 | 174 | swipe(startX, startY, endX, endY, duration); 175 | //toastLog(APP_name + "计数器:" + (i + 1)); 176 | // 生成2.6到8.7之间的随机数 177 | sleep(random(2600, 8700)); 178 | } 179 | } 180 | 181 | 182 | function handle() { 183 | sleep(3600); 184 | clickNonClickable("#pm", 5, 600); 185 | sleep(1600); 186 | home(); 187 | sleep(3*3600* 1000); 188 | 189 | } 190 | 191 | start1 = start() 192 | handle() 193 | stop() 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /js/木叶免费短剧.js: -------------------------------------------------------------------------------- 1 | //耗时3小时 2 | APP_name = "木叶免费短剧"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | 6 | //黑阈临时启动APP 7 | function start() { 8 | home(); 9 | sleep(500); 10 | home(); 11 | sleep(500); 12 | text("执行指令").findOne().click(); 13 | id("command").setText("launch-instant " + Package_name); 14 | sleep(600); 15 | id("exec").findOne().click(); 16 | } 17 | 18 | //常规启动APP 19 | function start0() { 20 | launch(getPackageName(APP_name)); 21 | var sh = new Shell(true); 22 | return sh; 23 | } 24 | 25 | //退出APP 26 | function stop() { 27 | launch(getPackageName(APP_name)); 28 | var sh = new Shell(true); 29 | sh.exec("am force-stop " + Package_name); 30 | sleep(1000); 31 | sh.exit; 32 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 33 | } 34 | 35 | //点击text/id;单个/首个目标 36 | function clickNonClickable(selector, maxRetries, retryDelay) { 37 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 38 | var target = null; 39 | 40 | if (selector.startsWith("#")) { 41 | // 如果选择器以"#"开头,表示使用id 42 | target = id(selector.substring(1)).findOne(); 43 | } else { 44 | // 否则,默认使用text 45 | target = text(selector).findOne(); 46 | } 47 | 48 | if (target) { 49 | // 尝试直接使用click函数点击目标控件 50 | if (target.clickable()) { 51 | target.click(); 52 | return; 53 | } else { 54 | // 如果clickable属性为false,尝试使用坐标点击 55 | var centerX = target.bounds().centerX(); 56 | var centerY = target.bounds().centerY(); 57 | 58 | click(centerX, centerY); 59 | return; 60 | } 61 | } else { 62 | sleep(retryDelay); 63 | } 64 | } 65 | toast("达到最大重试次数,点击" + selector + "失败"); 66 | } 67 | 68 | //点击置顶层text/id 69 | function clickToplayer(selector) { 70 | // 通过元素识别方法获取目标按钮的坐标 71 | var targetElement = null; 72 | 73 | if (selector.startsWith("#")) { 74 | // 如果选择器以"#"开头,表示使用id 75 | targetElement = id(selector.substring(1)).findOne(); 76 | } else { 77 | // 否则,默认使用text 78 | targetElement = text(selector).findOne(); 79 | } 80 | 81 | if (!targetElement) { 82 | toast("未找到目标元素:" + selector); 83 | return false; 84 | } 85 | 86 | // 获取目标元素的坐标 87 | var targetX = targetElement.bounds().centerX(); 88 | var targetY = targetElement.bounds().centerY(); 89 | 90 | // 模拟点击目标元素 91 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 92 | return true; 93 | } 94 | 95 | //Tap/click/press:坐标bounds(适应分辨率) 96 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 97 | // 解析传入的bounds字符串 98 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 99 | var match = boundsString.match(regex); 100 | 101 | if (!match) { 102 | console.error("传入的bounds格式不正确"); 103 | return; 104 | } 105 | 106 | // 获取设备宽度和高度 107 | var screenWidth = device.width; 108 | var screenHeight = device.height; 109 | 110 | // 计算目标区域的中心点坐标 111 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 112 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 113 | var right = parseInt(match[3]) * screenWidth / 1080; 114 | var bottom = parseInt(match[4]) * screenHeight / 2400; 115 | 116 | var centerX = (left + right) / 2; 117 | var centerY = (top + bottom) / 2; 118 | 119 | // 输出调试信息 120 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 121 | 122 | // 使用click函数点击目标区域的中心点 123 | click(centerX, centerY); 124 | } 125 | 126 | //点击第n个text/id;可超时 127 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 128 | var foundCount = 0; 129 | 130 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 131 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 132 | if (targets.length > 0) { 133 | // 检查是否存在足够的匹配项 134 | if (foundCount + targets.length >= n) { 135 | // 找到第n个匹配项 136 | var targetIndex = n - foundCount - 1; 137 | var target = targets[targetIndex]; 138 | 139 | // 尝试直接使用click函数点击目标控件 140 | if (target.clickable()) { 141 | target.click(); 142 | foundCount++; 143 | return; 144 | } else { 145 | // 如果clickable属性为false,尝试使用坐标点击 146 | var centerX = target.bounds().centerX(); 147 | var centerY = target.bounds().centerY(); 148 | 149 | click(centerX, centerY); 150 | foundCount++; 151 | return; 152 | } 153 | } else { 154 | // 增加已找到的计数 155 | foundCount += targets.length; 156 | } 157 | } else { 158 | sleep(retryDelay); 159 | } 160 | } 161 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 162 | } 163 | 164 | //刷视频 165 | function BrushVideos(a, b) { 166 | for (var i = 0; i < random(a, b); i++) { 167 | // 生成随机坐标和滑动时间 168 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 169 | var startY = random(2300 / 3168 * device.height, 2500 / 3168 * device.height); 170 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 171 | var endY = random(200 / 3168 * device.height, 350 / 3168 * device.height); 172 | var duration = random(420, 720); 173 | 174 | swipe(startX, startY, endX, endY, duration); 175 | //toastLog(APP_name + "计数器:" + (i + 1)); 176 | // 生成2.6到8.7之间的随机数 177 | sleep(random(2600, 8700)); 178 | } 179 | } 180 | 181 | 182 | function handle() { 183 | text("继续观看").waitFor(); 184 | clickNonClickable("继续观看", 5, 600); 185 | for (i = 0; i < 180; i++) { 186 | sleep(65* 1000); 187 | BrushVideos(1, 1); 188 | toastLog(APP_name + "计数器:" + (i + 1)); 189 | } 190 | } 191 | 192 | start1 = start() 193 | handle() 194 | stop() 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /js/红果免费短剧.js: -------------------------------------------------------------------------------- 1 | //耗时3小时 2 | APP_name = "红果免费短剧"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | 6 | //黑阈临时启动APP 7 | function start() { 8 | home(); 9 | sleep(500); 10 | home(); 11 | sleep(500); 12 | text("执行指令").findOne().click(); 13 | id("command").setText("launch-instant " + Package_name); 14 | sleep(600); 15 | id("exec").findOne().click(); 16 | } 17 | 18 | //常规启动APP 19 | function start0() { 20 | launch(getPackageName(APP_name)); 21 | var sh = new Shell(true); 22 | return sh; 23 | } 24 | 25 | //退出APP 26 | function stop() { 27 | launch(getPackageName(APP_name)); 28 | var sh = new Shell(true); 29 | sh.exec("am force-stop " + Package_name); 30 | sleep(1000); 31 | sh.exit; 32 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 33 | } 34 | 35 | //点击text/id;单个/首个目标 36 | function clickNonClickable(selector, maxRetries, retryDelay) { 37 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 38 | var target = null; 39 | 40 | if (selector.startsWith("#")) { 41 | // 如果选择器以"#"开头,表示使用id 42 | target = id(selector.substring(1)).findOne(); 43 | } else { 44 | // 否则,默认使用text 45 | target = text(selector).findOne(); 46 | } 47 | 48 | if (target) { 49 | // 尝试直接使用click函数点击目标控件 50 | if (target.clickable()) { 51 | target.click(); 52 | return; 53 | } else { 54 | // 如果clickable属性为false,尝试使用坐标点击 55 | var centerX = target.bounds().centerX(); 56 | var centerY = target.bounds().centerY(); 57 | 58 | click(centerX, centerY); 59 | return; 60 | } 61 | } else { 62 | sleep(retryDelay); 63 | } 64 | } 65 | toast("达到最大重试次数,点击" + selector + "失败"); 66 | } 67 | 68 | //点击置顶层text/id 69 | function clickToplayer(selector) { 70 | // 通过元素识别方法获取目标按钮的坐标 71 | var targetElement = null; 72 | 73 | if (selector.startsWith("#")) { 74 | // 如果选择器以"#"开头,表示使用id 75 | targetElement = id(selector.substring(1)).findOne(); 76 | } else { 77 | // 否则,默认使用text 78 | targetElement = text(selector).findOne(); 79 | } 80 | 81 | if (!targetElement) { 82 | toast("未找到目标元素:" + selector); 83 | return false; 84 | } 85 | 86 | // 获取目标元素的坐标 87 | var targetX = targetElement.bounds().centerX(); 88 | var targetY = targetElement.bounds().centerY(); 89 | 90 | // 模拟点击目标元素 91 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 92 | return true; 93 | } 94 | 95 | //Tap/click/press:坐标bounds(适应分辨率) 96 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 97 | // 解析传入的bounds字符串 98 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 99 | var match = boundsString.match(regex); 100 | 101 | if (!match) { 102 | console.error("传入的bounds格式不正确"); 103 | return; 104 | } 105 | 106 | // 获取设备宽度和高度 107 | var screenWidth = device.width; 108 | var screenHeight = device.height; 109 | 110 | // 计算目标区域的中心点坐标 111 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 112 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 113 | var right = parseInt(match[3]) * screenWidth / 1080; 114 | var bottom = parseInt(match[4]) * screenHeight / 2400; 115 | 116 | var centerX = (left + right) / 2; 117 | var centerY = (top + bottom) / 2; 118 | 119 | // 输出调试信息 120 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 121 | 122 | // 使用click函数点击目标区域的中心点 123 | click(centerX, centerY); 124 | } 125 | 126 | //点击第n个text/id;可超时 127 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 128 | var foundCount = 0; 129 | 130 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 131 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 132 | if (targets.length > 0) { 133 | // 检查是否存在足够的匹配项 134 | if (foundCount + targets.length >= n) { 135 | // 找到第n个匹配项 136 | var targetIndex = n - foundCount - 1; 137 | var target = targets[targetIndex]; 138 | 139 | // 尝试直接使用click函数点击目标控件 140 | if (target.clickable()) { 141 | target.click(); 142 | foundCount++; 143 | return; 144 | } else { 145 | // 如果clickable属性为false,尝试使用坐标点击 146 | var centerX = target.bounds().centerX(); 147 | var centerY = target.bounds().centerY(); 148 | 149 | click(centerX, centerY); 150 | foundCount++; 151 | return; 152 | } 153 | } else { 154 | // 增加已找到的计数 155 | foundCount += targets.length; 156 | } 157 | } else { 158 | sleep(retryDelay); 159 | } 160 | } 161 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 162 | } 163 | 164 | //刷视频 165 | function BrushVideos(a, b) { 166 | for (var i = 0; i < random(a, b); i++) { 167 | // 生成随机坐标和滑动时间 168 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 169 | var startY = random(2300 / 3168 * device.height, 2500 / 3168 * device.height); 170 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 171 | var endY = random(200 / 3168 * device.height, 350 / 3168 * device.height); 172 | var duration = random(420, 720); 173 | 174 | swipe(startX, startY, endX, endY, duration); 175 | //toastLog(APP_name + "计数器:" + (i + 1)); 176 | // 生成2.6到8.7之间的随机数 177 | sleep(random(2600, 8700)); 178 | } 179 | } 180 | 181 | 182 | function handle() { 183 | text("继续观看").waitFor(); 184 | clickNonClickable("继续观看", 5, 600); 185 | for (i = 0; i < 180; i++) { 186 | sleep(65* 1000); 187 | BrushVideos(1, 1); 188 | toastLog(APP_name + "计数器:" + (i + 1)); 189 | } 190 | } 191 | 192 | start1 = start() 193 | handle() 194 | stop() 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /js/tools.js: -------------------------------------------------------------------------------- 1 | //耗时 2 | APP_name = ""; 3 | Package_name = getPackageName(APP_name); 4 | 5 | //黑阈临时启动APP 6 | function start() { 7 | home(); 8 | sleep(500); 9 | clickNonClickable("执行指令",5,600); 10 | id("command").setText("launch-instant " + Package_name); 11 | sleep(800); 12 | clickNonClickable("#exec",5,600); 13 | } 14 | //常规启动APP 15 | function start0() { 16 | launch(getPackageName(APP_name)); 17 | var sh = new Shell(true); 18 | return sh; 19 | } 20 | 21 | //退出APP 22 | function stop() { 23 | launch(getPackageName(APP_name)); 24 | var sh = new Shell(true); 25 | sh.exec("am force-stop " + Package_name); 26 | sleep(1000); 27 | sh.exit; 28 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 29 | } 30 | 31 | //点击text/id;单个/首个目标 32 | function clickNonClickable(selector, maxRetries, retryDelay) { 33 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 34 | var target = null; 35 | 36 | if (selector.startsWith("#")) { 37 | // 如果选择器以"#"开头,表示使用id 38 | target = id(selector.substring(1)).findOne(); 39 | } else { 40 | // 否则,默认使用text 41 | target = text(selector).findOne(); 42 | } 43 | 44 | if (target) { 45 | // 尝试直接使用click函数点击目标控件 46 | if (target.clickable()) { 47 | target.click(); 48 | return; 49 | } else { 50 | // 如果clickable属性为false,尝试使用坐标点击 51 | var centerX = target.bounds().centerX(); 52 | var centerY = target.bounds().centerY(); 53 | 54 | click(centerX, centerY); 55 | return; 56 | } 57 | } else { 58 | sleep(retryDelay); 59 | } 60 | } 61 | toast("达到最大重试次数,点击" + selector + "失败"); 62 | } 63 | 64 | //点击第n个text/id;可超时 65 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 66 | var foundCount = 0; 67 | 68 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 69 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 70 | if (targets.length > 0) { 71 | // 检查是否存在足够的匹配项 72 | if (foundCount + targets.length >= n) { 73 | // 找到第n个匹配项 74 | var targetIndex = n - foundCount - 1; 75 | var target = targets[targetIndex]; 76 | 77 | // 尝试直接使用click函数点击目标控件 78 | if (target.clickable()) { 79 | target.click(); 80 | foundCount++; 81 | return; 82 | } else { 83 | // 如果clickable属性为false,尝试使用坐标点击 84 | var centerX = target.bounds().centerX(); 85 | var centerY = target.bounds().centerY(); 86 | 87 | click(centerX, centerY); 88 | foundCount++; 89 | return; 90 | } 91 | } else { 92 | // 增加已找到的计数 93 | foundCount += targets.length; 94 | } 95 | } else { 96 | sleep(retryDelay); 97 | } 98 | } 99 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 100 | } 101 | 102 | //点击置顶层*text/id 103 | function clickToplayer(selector) { 104 | // 通过元素识别方法获取目标按钮的坐标 105 | var targetElement = null; 106 | 107 | if (selector.startsWith("#")) { 108 | // 如果选择器以"#"开头,表示使用id 109 | targetElement = id(selector.substring(1)).findOne(); 110 | } else { 111 | // 否则,默认使用text 112 | targetElement = text(selector).findOne(); 113 | } 114 | 115 | if (!targetElement) { 116 | toast("未找到目标元素:" + selector); 117 | return false; 118 | } 119 | 120 | // 获取目标元素的坐标 121 | var targetX = targetElement.bounds().centerX(); 122 | var targetY = targetElement.bounds().centerY(); 123 | 124 | // 模拟点击目标元素 125 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 126 | return true; 127 | } 128 | 129 | //Tap/click/press:坐标bounds(适应分辨率) 130 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 131 | // 解析传入的bounds字符串 132 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 133 | var match = boundsString.match(regex); 134 | 135 | if (!match) { 136 | console.error("传入的bounds格式不正确"); 137 | return; 138 | } 139 | 140 | // 获取设备宽度和高度 141 | var screenWidth = device.width; 142 | var screenHeight = device.height; 143 | 144 | // 计算目标区域的中心点坐标 145 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 146 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 147 | var right = parseInt(match[3]) * screenWidth / 1080; 148 | var bottom = parseInt(match[4]) * screenHeight / 2400; 149 | 150 | var centerX = (left + right) / 2; 151 | var centerY = (top + bottom) / 2; 152 | 153 | // 输出调试信息 154 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 155 | 156 | // 使用click函数点击目标区域的中心点 157 | click(centerX, centerY); 158 | } 159 | 160 | 161 | //刷视频 162 | function BrushVideos(a,b){ 163 | for (var i = 0; i < random(a, b); i++) { 164 | // 生成随机坐标和滑动时间 165 | var startX = random(800/1440*device.width, 1100/1440*device.width); 166 | var startY = random(2210/3168*device.height, 2399/3168*device.height); 167 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 168 | var endY = random(200 / 3168 * device.height, 399 / 3168 * device.height); 169 | var duration = random(420, 720); 170 | 171 | swipe(startX, startY, endX, endY, duration); 172 | toastLog(APP_name + "计数器:" + (i + 1)); 173 | // 生成2.6到8.7之间的随机数 174 | sleep(random(2600, 8700)); 175 | } 176 | } 177 | 178 | //刷新闻 179 | function BrushNews(news,start_item,next_item) { 180 | for (j = 0; j < news; j++) { 181 | sleep(2100); 182 | clickNonClickable(start_item, 5, 500); 183 | for (var i = 0; i < 5; i++) { 184 | // 生成随机坐标和滑动时间 185 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 186 | var startY = random(1410 / 3168 * device.height, 1760 / 3168 * device.height); 187 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 188 | var endY = random(1090 / 3168 * device.height, 1240 / 3168 * device.height); 189 | var duration = random(420, 720); 190 | 191 | swipe(startX, startY, endX, endY, duration); 192 | // 生成随机数 193 | sleep(random(3660, 3680)); 194 | } 195 | toastLog(APP_name + "计数器:" + (j + 1)); 196 | clickNonClickable(next_item, 5, 500); 197 | } 198 | 199 | } 200 | 201 | //浮窗当前APP 202 | function FloatingCurrentAPP() { 203 | sleep(500); 204 | // 打开多任务视图 205 | recents(); 206 | desc("更多").findOne().click(); 207 | sleep(150); 208 | click("浮窗"); 209 | } 210 | 211 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /js/网上国网.js: -------------------------------------------------------------------------------- 1 | //耗时忽略 2 | APP_name = "网上国网"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | //黑阈临时启动APP 6 | function start() { 7 | home(); 8 | sleep(500); 9 | home(); 10 | sleep(500); 11 | text("执行指令").findOne().click(); 12 | id("command").setText("launch-instant " + Package_name); 13 | sleep(600); 14 | id("exec").findOne().click(); 15 | } 16 | //常规启动APP 17 | function start0() { 18 | launch(getPackageName(APP_name)); 19 | var sh = new Shell(true); 20 | return sh; 21 | } 22 | 23 | //退出APP 24 | function stop() { 25 | launch(getPackageName(APP_name)); 26 | var sh = new Shell(true); 27 | sh.exec("am force-stop " + Package_name); 28 | sleep(1000); 29 | sh.exit; 30 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 31 | } 32 | 33 | //点击text/id;单个/首个目标 34 | function clickNonClickable(selector, maxRetries, retryDelay) { 35 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 36 | var target = null; 37 | 38 | if (selector.startsWith("#")) { 39 | // 如果选择器以"#"开头,表示使用id 40 | target = id(selector.substring(1)).findOne(); 41 | } else { 42 | // 否则,默认使用text 43 | target = text(selector).findOne(); 44 | } 45 | 46 | if (target) { 47 | // 尝试直接使用click函数点击目标控件 48 | if (target.clickable()) { 49 | target.click(); 50 | return; 51 | } else { 52 | // 如果clickable属性为false,尝试使用坐标点击 53 | var centerX = target.bounds().centerX(); 54 | var centerY = target.bounds().centerY(); 55 | 56 | click(centerX, centerY); 57 | return; 58 | } 59 | } else { 60 | sleep(retryDelay); 61 | } 62 | } 63 | toast("达到最大重试次数,点击" + selector + "失败"); 64 | } 65 | 66 | //点击第n个text/id;可超时 67 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 68 | var foundCount = 0; 69 | 70 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 71 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 72 | if (targets.length > 0) { 73 | // 检查是否存在足够的匹配项 74 | if (foundCount + targets.length >= n) { 75 | // 找到第n个匹配项 76 | var targetIndex = n - foundCount - 1; 77 | var target = targets[targetIndex]; 78 | 79 | // 尝试直接使用click函数点击目标控件 80 | if (target.clickable()) { 81 | target.click(); 82 | foundCount++; 83 | return; 84 | } else { 85 | // 如果clickable属性为false,尝试使用坐标点击 86 | var centerX = target.bounds().centerX(); 87 | var centerY = target.bounds().centerY(); 88 | 89 | click(centerX, centerY); 90 | foundCount++; 91 | return; 92 | } 93 | } else { 94 | // 增加已找到的计数 95 | foundCount += targets.length; 96 | } 97 | } else { 98 | sleep(retryDelay); 99 | } 100 | } 101 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 102 | } 103 | 104 | //点击置顶层*text/id 105 | function clickToplayer(selector) { 106 | // 通过元素识别方法获取目标按钮的坐标 107 | var targetElement = null; 108 | 109 | if (selector.startsWith("#")) { 110 | // 如果选择器以"#"开头,表示使用id 111 | targetElement = id(selector.substring(1)).findOne(); 112 | } else { 113 | // 否则,默认使用text 114 | targetElement = text(selector).findOne(); 115 | } 116 | 117 | if (!targetElement) { 118 | toast("未找到目标元素:" + selector); 119 | return false; 120 | } 121 | 122 | // 获取目标元素的坐标 123 | var targetX = targetElement.bounds().centerX(); 124 | var targetY = targetElement.bounds().centerY(); 125 | 126 | // 模拟点击目标元素 127 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 128 | return true; 129 | } 130 | 131 | //Tap/click/press:坐标bounds(适应分辨率) 132 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 133 | // 解析传入的bounds字符串 134 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 135 | var match = boundsString.match(regex); 136 | 137 | if (!match) { 138 | console.error("传入的bounds格式不正确"); 139 | return; 140 | } 141 | 142 | // 获取设备宽度和高度 143 | var screenWidth = device.width; 144 | var screenHeight = device.height; 145 | 146 | // 计算目标区域的中心点坐标 147 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 148 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 149 | var right = parseInt(match[3]) * screenWidth / 1080; 150 | var bottom = parseInt(match[4]) * screenHeight / 2400; 151 | 152 | var centerX = (left + right) / 2; 153 | var centerY = (top + bottom) / 2; 154 | 155 | // 输出调试信息 156 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 157 | 158 | // 使用click函数点击目标区域的中心点 159 | click(centerX, centerY); 160 | } 161 | 162 | 163 | //刷视频 164 | function BrushVideos(a,b){ 165 | for (var i = 0; i < random(a, b); i++) { 166 | // 生成随机坐标和滑动时间 167 | var startX = random(800/1440*device.width, 1100/1440*device.width); 168 | var startY = random(2210/3168*device.height, 2399/3168*device.height); 169 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 170 | var endY = random(200 / 3168 * device.height, 399 / 3168 * device.height); 171 | var duration = random(420, 720); 172 | 173 | swipe(startX, startY, endX, endY, duration); 174 | toastLog(APP_name + "计数器:" + (i + 1)); 175 | // 生成2.6到8.7之间的随机数 176 | sleep(random(2600, 8700)); 177 | } 178 | } 179 | 180 | //刷新闻 181 | function BrushNews(news,start_item,next_item) { 182 | for (j = 0; j < news; j++) { 183 | sleep(2100); 184 | clickNonClickable(start_item, 5, 500); 185 | for (var i = 0; i < 5; i++) { 186 | // 生成随机坐标和滑动时间 187 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 188 | var startY = random(1410 / 3168 * device.height, 1760 / 3168 * device.height); 189 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 190 | var endY = random(1090 / 3168 * device.height, 1240 / 3168 * device.height); 191 | var duration = random(420, 720); 192 | 193 | swipe(startX, startY, endX, endY, duration); 194 | // 生成随机数 195 | sleep(random(3660, 3680)); 196 | } 197 | toastLog(APP_name + "计数器:" + (j + 1)); 198 | clickNonClickable(next_item, 5, 500); 199 | } 200 | 201 | } 202 | 203 | //浮窗当前APP 204 | function FloatingCurrentAPP() { 205 | sleep(500); 206 | // 打开多任务视图 207 | recents(); 208 | desc("更多").findOne().click(); 209 | sleep(150); 210 | click("浮窗"); 211 | } 212 | function handle(){ 213 | clickNonClickable("签到",3,1000); 214 | sleep(5500); 215 | } 216 | 217 | start() 218 | handle() 219 | stop() 220 | 221 | 222 | 223 | -------------------------------------------------------------------------------- /js/新氧.js: -------------------------------------------------------------------------------- 1 | //耗时忽略 2 | APP_name = "新氧医美"; 3 | Package_name = getPackageName(APP_name); 4 | 5 | //黑阈临时启动APP 6 | function start() { 7 | home(); 8 | sleep(500); 9 | clickNonClickable("执行指令",5,600); 10 | id("command").setText("launch-instant " + Package_name); 11 | sleep(400); 12 | clickNonClickable("#exec",5,600); 13 | } 14 | //常规启动APP 15 | function start0() { 16 | launch(getPackageName(APP_name)); 17 | var sh = new Shell(true); 18 | return sh; 19 | } 20 | 21 | //退出APP 22 | function stop() { 23 | launch(getPackageName(APP_name)); 24 | var sh = new Shell(true); 25 | sh.exec("am force-stop " + Package_name); 26 | sleep(1000); 27 | sh.exit; 28 | toastLog("【" + APP_name + "】已完成计划任务并退出APP!"); 29 | } 30 | 31 | //点击text/id;单个/首个目标 32 | function clickNonClickable(selector, maxRetries, retryDelay) { 33 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 34 | var target = null; 35 | 36 | if (selector.startsWith("#")) { 37 | // 如果选择器以"#"开头,表示使用id 38 | target = id(selector.substring(1)).findOne(); 39 | } else { 40 | // 否则,默认使用text 41 | target = text(selector).findOne(); 42 | } 43 | 44 | if (target) { 45 | // 尝试直接使用click函数点击目标控件 46 | if (target.clickable()) { 47 | target.click(); 48 | return; 49 | } else { 50 | // 如果clickable属性为false,尝试使用坐标点击 51 | var centerX = target.bounds().centerX(); 52 | var centerY = target.bounds().centerY(); 53 | 54 | click(centerX, centerY); 55 | return; 56 | } 57 | } else { 58 | sleep(retryDelay); 59 | } 60 | } 61 | toast("达到最大重试次数,点击" + selector + "失败"); 62 | } 63 | 64 | //点击第n个text/id;可超时 65 | function clickNonClickableN(selector, n, maxRetries, retryDelay) { 66 | var foundCount = 0; 67 | 68 | for (var attempt = 1; attempt <= maxRetries; attempt++) { 69 | var targets = selector.startsWith("#") ? id(selector.substring(1)).find() : text(selector).find(); 70 | if (targets.length > 0) { 71 | // 检查是否存在足够的匹配项 72 | if (foundCount + targets.length >= n) { 73 | // 找到第n个匹配项 74 | var targetIndex = n - foundCount - 1; 75 | var target = targets[targetIndex]; 76 | 77 | // 尝试直接使用click函数点击目标控件 78 | if (target.clickable()) { 79 | target.click(); 80 | foundCount++; 81 | return; 82 | } else { 83 | // 如果clickable属性为false,尝试使用坐标点击 84 | var centerX = target.bounds().centerX(); 85 | var centerY = target.bounds().centerY(); 86 | 87 | click(centerX, centerY); 88 | foundCount++; 89 | return; 90 | } 91 | } else { 92 | // 增加已找到的计数 93 | foundCount += targets.length; 94 | } 95 | } else { 96 | sleep(retryDelay); 97 | } 98 | } 99 | toast("达到最大重试次数,未找到第 " + n + " 个匹配项:" + selector); 100 | } 101 | 102 | //点击置顶层*text/id 103 | function clickToplayer(selector) { 104 | // 通过元素识别方法获取目标按钮的坐标 105 | var targetElement = null; 106 | 107 | if (selector.startsWith("#")) { 108 | // 如果选择器以"#"开头,表示使用id 109 | targetElement = id(selector.substring(1)).findOne(); 110 | } else { 111 | // 否则,默认使用text 112 | targetElement = text(selector).findOne(); 113 | } 114 | 115 | if (!targetElement) { 116 | toast("未找到目标元素:" + selector); 117 | return false; 118 | } 119 | 120 | // 获取目标元素的坐标 121 | var targetX = targetElement.bounds().centerX(); 122 | var targetY = targetElement.bounds().centerY(); 123 | 124 | // 模拟点击目标元素 125 | gesture(500, [targetX, targetY], [targetX, targetY], [targetX, targetY]); 126 | return true; 127 | } 128 | 129 | //Tap/click/press:坐标bounds(适应分辨率) 130 | function clickNonClickableByBounds(boundsString, maxRetries, retryDelay) { 131 | // 解析传入的bounds字符串 132 | var regex = /\((\d+),(\d+),(\d+),(\d+)\)/; 133 | var match = boundsString.match(regex); 134 | 135 | if (!match) { 136 | console.error("传入的bounds格式不正确"); 137 | return; 138 | } 139 | 140 | // 获取设备宽度和高度 141 | var screenWidth = device.width; 142 | var screenHeight = device.height; 143 | 144 | // 计算目标区域的中心点坐标 145 | var left = parseInt(match[1]) * screenWidth / 1080; // 1080是假设的标准分辨率 146 | var top = parseInt(match[2]) * screenHeight / 2400; // 1920是假设的标准分辨率 147 | var right = parseInt(match[3]) * screenWidth / 1080; 148 | var bottom = parseInt(match[4]) * screenHeight / 2400; 149 | 150 | var centerX = (left + right) / 2; 151 | var centerY = (top + bottom) / 2; 152 | 153 | // 输出调试信息 154 | // console.log("目标区域中心点坐标:" + centerX + ", " + centerY); 155 | 156 | // 使用click函数点击目标区域的中心点 157 | click(centerX, centerY); 158 | } 159 | 160 | 161 | //刷视频 162 | function BrushVideos(a,b){ 163 | for (var i = 0; i < random(a, b); i++) { 164 | // 生成随机坐标和滑动时间 165 | var startX = random(800/1440*device.width, 1100/1440*device.width); 166 | var startY = random(2210/3168*device.height, 2399/3168*device.height); 167 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 168 | var endY = random(200 / 3168 * device.height, 399 / 3168 * device.height); 169 | var duration = random(420, 720); 170 | 171 | swipe(startX, startY, endX, endY, duration); 172 | toastLog(APP_name + "计数器:" + (i + 1)); 173 | // 生成2.6到8.7之间的随机数 174 | sleep(random(2600, 8700)); 175 | } 176 | } 177 | 178 | //刷新闻 179 | function BrushNews(news,start_item,next_item) { 180 | for (j = 0; j < news; j++) { 181 | sleep(2100); 182 | clickNonClickable(start_item, 5, 500); 183 | for (var i = 0; i < 5; i++) { 184 | // 生成随机坐标和滑动时间 185 | var startX = random(800 / 1440 * device.width, 1100 / 1440 * device.width); 186 | var startY = random(1410 / 3168 * device.height, 1760 / 3168 * device.height); 187 | var endX = random(900 / 1440 * device.width, 1020 / 1440 * device.width); 188 | var endY = random(1090 / 3168 * device.height, 1240 / 3168 * device.height); 189 | var duration = random(420, 720); 190 | 191 | swipe(startX, startY, endX, endY, duration); 192 | // 生成随机数 193 | sleep(random(3660, 3680)); 194 | } 195 | toastLog(APP_name + "计数器:" + (j + 1)); 196 | clickNonClickable(next_item, 5, 500); 197 | } 198 | 199 | } 200 | 201 | //浮窗当前APP 202 | function FloatingCurrentAPP() { 203 | sleep(500); 204 | // 打开多任务视图 205 | recents(); 206 | desc("更多").findOne().click(); 207 | sleep(150); 208 | click("浮窗"); 209 | } 210 | function handle(){ 211 | clickNonClickableN("我的", 1,8, 600); 212 | clickNonClickable("#iv_my_sign", 4, 600); 213 | sleep(2600); 214 | clickNonClickable("#btnSignGet", 4, 600); 215 | sleep(1500); 216 | 217 | } 218 | 219 | start() 220 | handle() 221 | stop() 222 | 223 | 224 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------