微信定时任务

登录网页版微信
登录微信以后,选中对象
使用浏览器的调试工具,打开控制台
贴上代码

===每秒钟判断一下是否是设定的时间(定时任务电脑时间)===

var appElement = document.querySelector(‘[ng-controller=chatSenderController]‘);var $scope = angular.element(appElement).scope();setInterval(function(){ var now= new Date(); var date=now.getDate(); var hour = now.getHours(); var min = now.getMinutes(); var second = now.getSeconds(); if(second == 0 && min ==57 && hour ==23 ){ var output = ‘<img class="qqemoji qqemoji18" text="[抓狂]_web" src="/zh_CN/htmledition/v2/images/spacer.gif">‘ $scope.editAreaCtn = output; $scope.sendTextMessage(); }},1000);

===每秒钟发送一次===

var appElement = document.querySelector(‘[ng-controller=chatSenderController]‘);var $scope = angular.element(appElement).scope();setInterval(function(){ var output = "测试"+‘<img class="qqemoji qqemoji18" text="[抓狂]_web" src="/zh_CN/htmledition/v2/images/spacer.gif">‘ $scope.editAreaCtn = output; $scope.sendTextMessage();},1000);

PS:
1.可以修改if的时间来进行定时
2.可以修改最后的1000,1000代表每1000毫秒

微信定时任务

相关文章