Autojs6-微信全自动定时接龙

Autojs6微信接龙的脚本。
配合Tasker实现定时微信接龙。
实现接龙自动发送当天的日期、星期、天气。
天气接口使用最美天气的网页进行天气信息剪裁。

//获取当天的年月日
currentTime = new Date();
var currentDate = currentTime.getFullYear() + "/"
+ (currentTime.getMonth() + 1) + "/"
+ currentTime.getDate();
currentDate.toString();
//获取当天的星期
var week="星期"+"日一二三四五六".charAt(new Date().getDay());
//获取天气
var weather="";
var res = http.get("https://h5.zuimeitianqi.com/page/zh/daily.html?cityId=0101231407&lan=zh-cn&partner=hw&l=1007.132486,924.707676&il=0&enableAdType=0&enableHWflow=0&appVersion=14.0.5.300");
if(res.statusCode != 200){
    weather="天气获取失败";
}else{
    var html_str = res.body.string();
   var res1 = new RegExp('<[^<>]+>','g');
var res2= html_str.replace(res1 ,"");
weather=textcut(res2,"desc\":\"",";\"}, cityInfo");
}
jielong()
function jielong()
{
launch("com.tencent.mm");
sleep(1000);
click(301,1883);//点击微信分身第一个
waitForPackage("com.tencent.mm");
 
text("通讯录").untilFind();
log("微信启动完闭");
console.hide();
 
var qun=text("****").findOne(3000);//****为置顶的群聊名称
if(qun!=null)
{
click(qun.bounds().centerX(), qun.bounds().centerY());
}
faxiaoxi =id("o4q").findOne().click()
    sleep(500);// 到达聊天框
        wenben =  className("EditText").findOne();
        wenben.setText("");
        sleep(500);
        wenben.setText("#接龙");
        sleep(1000);
var send=id("bql").bounds(896,2222,1058,2308).findOne(2000);
if(send!=null)
{
     click(779,2086);//若键盘未出现点下面的发送,若键盘出现点上面。
        }
else
{
     click(777,1263);
        }
sleep(1000);
wenben1 =  className("EditText").findOne();
   
wenben1.setText(currentDate+week+"\n"+weather+"\n********"); //这里******填你要发送的接龙消息
text("发送").findOne().click();
sleep(500);
}
//文本截取
function textcut(str, firstStr, secondStr)
{
    if (firstStr == "")
     {
     str = "**" + str; firstStr = "**";
     }
    if (secondStr == "")
     {
     str = str + "**"; secondStr = "**";
      }
     
    if (str == "" || str == null || str == undefined)
    {
        return "";
    }
    if (str.indexOf(firstStr) < 0)
    {
        return "";
    }
    var subFirstStr = str.substring(str.indexOf(firstStr) + firstStr.length, str.length);
    var subSecondStr = subFirstStr.substring(0, subFirstStr.indexOf(secondStr));
    return subSecondStr;
    }
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 共4条

请登录后发表评论