console.show();//Set console // 设备信息 var WIDTH = device.width, HEIGHT = device.height, TYPE = device.brand + ' ' + device.model;
console.clear;
log('\n分辨率:', WIDTH, '*', HEIGHT);
let StartServer = true;// 判断服务是否开启
while (StartServer) { if (!id("iv_home_msg").findOnce()) { log("不在小嘿盒主页,请手动打开"); // 不在小黑盒主页跳过 sleep(1000);// 等待1s continue; } else { let title = className("androidx.recyclerview.widget.RecyclerView").findOne(); // 执行share任务 log("执行share任务..."); let i = 1;
try { Tv = title.child(i); Tv.click(); } catch (error) { sleep(1000); } sleep(500); log("准备分享"); // 稍微判断一手 while (!id("iv_appbar_action_button").findOne()) { log("没找到"); continue; } let b = id("button_right").findOne().bounds(); let count_tmp = 0; while (!text("微信好友").findOnce()) { click(b.centerX(), b.centerY());//再点一次 if (count_tmp++ > 500) { log("share error"); break; } sleep(500); if (count_tmp >= 1) log("click another!"); } sleep(2500); text("微信好友").findOne().parent().click(); sleep(1500);
while (!back()) { continue; } log("分享成功"); sleep(1500); while (!back()) { continue; } sleep(1000);