auto.waitFor();
if(!requestScreenCapture()){
toast("请求截图失败");
exit();
}
var time = random(1000,2000);
var appname="百度贴吧";
var z=2;
while(z>1)
{
sleep(1000);
launchApp(appname);
sleep(5000)
back();
sleep(30000)
back();
if(className("android.widget.TextView").text("我的").exists()){
var d1 = className("android.widget.TextView").text("我的").findOne();
}
z++;
while(z>2)
{
toastLog("开始");
randomClick(d1);
setScreenMetrics(720,1280);
sleep(1500);
click(98,362);//点击我的帖子
sleep(2000);
setScreenMetrics(device.width,device.height);
click("关闭应用");
var a=1;
while(a<4){
if(text("已无更多").exists()){
var d = text("已无更多").findOne().bounds();
randomClick1(d);
a=4;
}else{
gestures([350, [300, 400], [300, 1400]],
[350, [900, 400], [900, 1400]]);
sleep(2000);
a++;
}
}
sleep(2000);
if(id("pb_editor_tool_comment_reply_text").exists()){
d = id("pb_editor_tool_comment_reply_text").findOne();
a=1;
}else{
sleep(2000)
a=60;
}
while(a<60){
randomClick(d);
sleep(time);
var emoji = ['#(呵呵)','#(哈哈)','#(吐舌)','#(啊)','#(酷)','#(怒)','#(开心)','#(汗)','#(泪)','#(黑线)','#(鄙视)','#(不高兴)','#(真棒)','#(钱)','#(疑问)','#(阴险)','#(吐)','#(咦)','#(委屈)','#(花心)','#(呼~)','#(笑眼)','#(冷)','#(太开心)','#(滑稽)','#(勉强)','#(狂汗)','#(乖)','#(睡觉)','#(惊哭)','#(升起)','#(惊讶)','#(喷)','#(爱心)','#(心碎)','#(玫瑰)','#(礼物)','#(彩虹)','#(星星月亮)','#(太阳)','#(灯泡)','#(茶杯)','#(蛋糕)','#(音乐)','#(钱币)'];
var sjemoji = emoji[parseInt(Math.random() * emoji.length)]
setText("加油"+sjemoji);
sleep(time);
var img1 = captureScreen();
toastLog("开始找色");
var point = findColor(
img1,"#7559FF",{
region:[ device.width/2,device.height/2-100,device.width-device.width/2,device.height-device.height/2 ],
threshold:4
});
if(point){
click(point.x+10,point.y+10);
}else{
a=60;
}
a++;
var s = new Date();
var month = s.getHours();
if (month < 9){
sleep(1200000);
if (month > 2){
sleep(2200000);
}
}
sleep(55000);
}
sleep(2000);
back();
sleep(3000);
//click("取消");
back();
a=1;
while(a<3){
sleep(3000);
if(className("android.widget.TextView").text("我的").exists()){
randomClick(d1);
}
var img1 = captureScreen();
toastLog("开始找到设置");
var point = findColor(
img1,"#141414",{
region:[ device.width-80,80,20,20 ],
threshold:4
});
toastLog(point);
if(point){
toastLog("找到设置啦");
click(point.x,point.y);
a=4;
}else{
toastLog("没找到设置");
a++;
back();
sleep(2000);
click("取消");
}
}
sleep(1000);
if(id("com.baidu.tieba:id/accountManager").exists()){
var d = id("com.baidu.tieba:id/accountManager").findOne();
randomClick(d)
log("我的账号找到了")
}else{
sleep(1000);
a=3;
}
sleep(1000);
if(id("com.baidu.tieba:id/navi_right_button").exists()){
var d = id("com.baidu.tieba:id/navi_right_button").findOne().bounds();
randomClick2(d) //我的账号第二个
sleep(1000);
}else{
if(a==3){
var z=2;
sleep(1000);
killApp(appname)
}else{
back();
sleep(3000);
back();
}
}
sleep(4000);
var img1 = captureScreen();
var point = findColor(
img1,"#ff392c",{
region:[ device.width/2,device.height-150,device.width-device.width/2,100 ],
threshold:4
});
if(point){
click(point.x,point.y)
sleep(2000);
var img1 = captureScreen();
var point = findColor(
img1,"#ff392c",{
region:[ device.width/2,device.height/4,device.width/2,device.height/2 ],
threshold:4
});
if(point){
click(point.x,point.y)
sleep(2000);
}
if(text("站务消息").exists()){
sleep(3600000);
}
back();
sleep(2000);
}
}
}
function randomClick(dianji)//点击控件
{
var bound = dianji.bounds();
var randX = bound.left + random((bound.right - bound.left) / 2 - 10,(bound.right - bound.left) / 2 + 10);
var randY = bound.top + random((bound.bottom - bound.top) / 2 - 10,(bound.bottom - bound.top) / 2 + 10);
click(randX,randY)
};
function randomClick1(bound)//点击范围
{
var randX = bound.left + random(5,bound.right - bound.left - 5);
var randY = bound.top + random(5,bound.bottom - bound.top - 5);
click(randX,randY-200)
};
function randomClick2(bound)//点击范围
{
var randX = bound.left + random(5,bound.right - bound.left - 5);
var randY = bound.top + random(5,bound.bottom - bound.top - 5);
click(randX,randY+210)
};
function killApp(name){//关闭应用程序
sleep (2000);
recents();// 进入任务窗口
sleep(1000);
if(desc(name + ",未加锁").exists()){
var app = desc(name + ",未加锁").findOne().bounds();//获取应用的bounds布局属性
console.log(app);
swipe(app.centerX(), app.centerY(), device.width+1000, app.centerY(), 300);//模拟滑屏
sleep(1000);
}
if(desc(name).exists()){
var app = desc(name).findOne().bounds();//获取应用的bounds布局属性
console.log(app);
swipe(app.centerX(), app.centerY(), device.width+1000, app.centerY(), 300);//模拟滑屏
sleep(1000);
}
home();//返回桌面
sleep(1000);
};
autojs写的手机顶帖脚本源码
需积分: 5 150 浏览量
2022-04-14
12:23:46
上传
评论
收藏 2KB ZIP 举报
qingniaoliangge
- 粉丝: 5
- 资源: 4
评论0