脚本出处来自吾爱破解:作者( Mr.Lih)原文链接:www.52pojie.cn/thread-1042… 本人只是在作者的基础上做了小改动,以下是本人改动过的代码,如看原文代码,可以直接去论坛搜索。
auto.waitFor();
var height = device.height;
var width = device.width;
toast("\n设备宽" + width + "\n" + "设备高" + height + "\n" + "手机型号" + device.model + "\n安卓版本" + device.release)
if (height == 2220) { //设置脚本坐标点击所适合的屏幕宽高。(就是设置自己手机的分辨率,本人是三星s9)
setScreenMetrics(1080, 2220);
toast("设备高" + height);
lingqu();
}
function lingqu() {
app.launchApp("手机淘宝");
toast("打开淘宝")
sleep(6000);
click(600, 1235);//进入活动页
sleep(6000);
click(547, 1264);//点猫 领金币
// //浏览15秒领金币
sleep(1000);
click(911, 1716);
sleep(1500);
if (text("签到").exists()) {
text("签到").findOne().click();
sleep(1600);
toast("签到成功")
}
sleep(1500);
while (text("去进店").exists()) {
//要支持的动作
toast("存在去进店");
text("去进店").findOne().click();
sleep(2500);
swipe(width / 2, height - 600, width / 2, 0, 500);
sleep(3500);
swipe(width / 2, height - 600, width / 2, 0, 500);
sleep(10000);
swipe(width / 2, height - 600, width / 2, 0, 500);
sleep(3000);
back();
sleep(3000);
}
while (text("去浏览").exists()) {
//要支持的动作
toast("存在去浏览");
text("去浏览").findOne().click();
sleep(1500);
swipe(width / 2, height - 500, width / 2, 0, 500);
sleep(2500);
swipe(width / 2, height - 500, width / 2, 0, 500);
sleep(10000);
swipe(width / 2, height - 500, width / 2, 0, 500);
sleep(8000);
back();
sleep(1600);
var A=currentActivity()
if(A=="com.taobao.tao.TBMainActivity"){
toast("天猫首页")
exit()
}
}
while (text("去签到").exists()){ //这是本人看到领喵币有“去签到”,所以照葫芦画瓢。
toast("存在去签到");
text("马上签到").findOne().click();
sleep(1600);
toast("去签到成功");
back();
}
toast("结束");
}
如果发现不能用,请一定注意权限是否有给软件,auto.js版本本人测试的是4.0以上的版本,所以建议大家最好安装最新版本。本代码流程比较清晰,我一个非前端人员也能理解。