auto.js 实现信息发送、QQ点赞、微信点赞、健康日报签到
生活随笔
收集整理的這篇文章主要介紹了
auto.js 实现信息发送、QQ点赞、微信点赞、健康日报签到
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- auto.js開發文檔
- 安裝total control
- 在手機端安裝auto.js apk
- 安裝vscode
- 短信多條發送
- QQ點贊
- 微信點贊
- 健康日報填寫
- 疊貓貓
auto.js開發文檔
點擊學習
安裝total control
total control 用于手機投屏在電腦屏幕上
在手機端安裝auto.js apk
鏈接:https://pan.baidu.com/s/11aYh0vy4d-X9bFJtCse5rQ
提取碼:life
復制這段內容后打開百度網盤手機App,操作更方便哦
安裝vscode
(1)安裝完成后,在商店內輸入chinese,選擇中文安裝,快捷鍵 ctrl+shirt+p 輸入configure 選擇zh-ch,重啟即可
(2)在商店輸入 hyb1996,選擇第一個免費版的
(3)快捷鍵 ctrl+shirt+p 輸入auto.js server running
(4)快捷鍵 ctrl+shirt+p 輸入auto.js start server
(8)打開手機端auto.js app 點做上講選擇連接電腦。
(6)輸入電腦端ip(記住一定要在一個局域網上,比如手機和電腦連的WIFI是同一個)
短信多條發送
while(true){ var 文本框 = id("input").findOne(); 文本框.setText("your name"); var 發送 = id("fun_btn").findOne(); 發送.click() }QQ點贊
"auto";function 下滑(){className("AbsListView").scrollable().scrollForward(); }function 贊(){className("ImageView").desc("贊").click(); }function 顯示更多(){for(let i = 0; i < 2;i++){click("顯示更多");} }toast("請打開自己的資料頁,點擊點贊圖標"); sleep(100);while(notStopped()){for(let i = 0; i < 10; i++){贊();}顯示更多();下滑(); }微信點贊
while(true){dianzan(); }// 點贊當前頁面的動態 function dianzan(){// 這里是需找到可以滾動的控件:ListView,className是不會改變的,這樣寫出來的程序會比較穩定var scroll=className("ListView").findOne();// 子控件var scroll_thing=scroll.children();// 遍歷子控件scroll_thing.forEach((item,position)=>{var comment = item.findOne(desc("評論"));if(comment){comment.click();sleep(200)// 根據當前的選擇器所確定的篩選條件,對屏幕上的控件進行搜索,如果找到符合條件的控件則返回該控件;否則返回nullclick("贊")sleep(500);}});// 直接調用向下滾動的方法scrollDown();sleep(1000); }健康日報填寫
// auto; // var packageName = getPackageName("微信"); // openAppSetting(packageName); // var close = className("android.widget.Button").id("right_button").findOne().click(); // log(close); // sleep(100); // var cl2 = className("android.widget.Button").text("強行停止").findOne(); // console.log(cl2); // cl2.click(); // sleep(200); var s = "學生工作在線"; launchApp("微信"); sleep(3000)// var sousuo = packageName("com.tencent.mm").id("f8y").findOne(2000);//進行搜索var sousuo = className("android.widget.ImageView").id("f8y").findOne(2000);//進行搜索 log(sousuo); if(sousuo!=null){click(sousuo.bounds().centerX(),sousuo.bounds().centerY()); }sleep(2000); setText("0",s); sleep(2000)var nyist = className("android.widget.TextView").text(s).findOnce(0);log(nyist); if(nyist==null) exit();click(nyist.bounds().centerX(),nyist.bounds().centerY()); sleep(500); var jiankang = className("android.widget.TextView").text("晨午日報").findOne(2000); console.log(jiankang); click(jiankang.bounds().centerX(),jiankang.bounds().centerY()); sleep(500); var ribao = className("android.widget.TextView").text("健康日報").findOne(2000); console.log(ribao); click(ribao.bounds().centerX(),ribao.bounds().centerY());sleep(2000); var ribao = className("android.widget.RadioButton").text("在校").findOne(2000); console.log(ribao);ribao.click(); log(device.width); log(device.height) swipe(300,1000,300,1,1000); swipe(300,1000,300,1,1000); // var sumit =className("android.view.View").id("submit").findOne(2000); var sumit =className("android.view.View").text("提交").findOne(2000); log(sumit); if(sumit==null){exit(); } click(sumit.bounds().centerX(),sumit.bounds().centerY()); sleep(500); click("確定");home();疊貓貓
/*** 淘寶+京東雙十一活動腳本* 支持淘寶\支付寶\京東任務自動執行* * Author: Hyue418* Date: 2020/10/21* Time: 21:16* Versions: 2.1.0* Github: https://github.com/hyue418*/try {auto(); } catch (error) {toast("請手動開啟無障礙并授權給Auto.js");sleep(2000);exit(); }//初始化參數 versions = 'V2.1.0'; speed = 1; float = 1.25; patNum = 0; swipeTips = "滑啊滑啊滑啊滑"; taskChooseList = ["淘寶賺喵幣", "淘寶拍貓貓", "支付寶賺喵幣", "京東全民營業"]; taobaoActivityData = "taobao://pages.tmall.com/wow/z/hdwk/act-20201111/index"; activityActivityData = "alipays://platformapi/startapp?appId=68687502";height = device.height; width = device.width; setScreenMetrics(width, height);console.show(); log("淘寶+京東雙十一活動腳本" + versions + "\n"); log("腳本執行期間請勿手動點擊按鈕"); log("========================="); log("GitHub: https://github.com/hyue418"); log("Powered By Hyue418"); log("========================="); alert("【淘寶+京東雙十一活動腳本 " + versions + "】", "腳本執行過程請勿手動點擊按鈕,否則腳本執行可能會錯亂,導致任務失敗\n\n執行淘寶任務時請確保使用低版本淘寶(V9.5及以下),否則無法獲取獎勵\n\n最新版腳本請到GitHub獲取\nGitHub: https://github.com/hyue418\n\nPowered By Hyue418"); //開始執行任務彈窗 taskChoose(); log("GitHub: https://github.com/hyue418"); log("Powered By Hyue418"); alert("任務已完成", "所有任務貌似都做完啦!\n若仍有任務請重新運行噢!\n\nGitHub: https://github.com/hyue418\nPowered By Hyue418");/*** 任務選擇*/ function taskChoose() {var options = dialogs.multiChoice("請選擇需要執行的任務", taskChooseList);if (options == '') {toastLog("腳本已退出");exit();}//選中拍貓貓時彈出次數選擇if (options.indexOf(1) > -1) {var frequencyOptions = [10, 30, 50, 100, 200];var i = dialogs.select("請選擇拍貓貓次數",frequencyOptions);if (i == -1) {toastLog("腳本已退出");exit();}//拍貓次數加隨機數,向下取整patNum = Math.floor(ramdomByFloat(frequencyOptions[i]));toastLog("選擇拍貓貓" + frequencyOptions[i] + "次,加隨機數至" + patNum + "次");}runOptions(options); }/*** 執行選中任務* @param options 選項數組*/ function runOptions(options) {options.forEach(option => {switch (option) {case 0://執行淘寶任務var taskList = ['簽到', '領取', '去瀏覽', '去搜索', '去觀看', '領取獎勵', '去完成'];log("=====開始執行" + taskChooseList[option] + "=====");runTaobao("手機淘寶", taobaoActivityData, taskList);break;case 1://執行拍貓貓任務log("=====開始執行" + taskChooseList[option] + "=====");options.indexOf(0) > -1 ? patCat(patNum, 1) : patCat(patNum, 2);break;case 2://執行支付寶任務var taskList = ['簽到', '逛一逛'];log("=====開始執行" + taskChooseList[option] + "=====");activityData = "alipays://platformapi/startapp?appId=68687502";runTaobao("支付寶", activityActivityData, taskList);break;case 3://執行京東任務var taskList = ['簽到', '去完成'];log("=====開始執行" + taskChooseList[option] + "=====");runJd(taskList);break;default:break;}}); }/*** 淘寶活動腳本,兼容淘寶&支付寶* @param appName * @param activityData * @param taskList */ function runTaobao(appName, activityData, taskList) {var i = j = 0;toastLog("打開【" + appName + "】活動頁");app.startActivity({action: "VIEW",data: activityData})randomSleep(1000 * speed);className("android.widget.Button").text("賺喵幣").waitFor()randomSleep(1000 * speed);if (!textContains("累計任務獎勵").exists()) {clickContent("賺喵幣");}randomSleep(1500 * speed);if (className("android.widget.Button").text("領取獎勵").exists()) {clickContent("領取獎勵");randomSleep(200 * speed);log("領取獎勵成功");}randomSleep(1500 * speed);taskList.forEach(task => {while (textContains(task).exists()) {var button = text(task).findOnce(j);if (button == null) {break;}log("開始做第" + (i + 1) + "次任務");switch (task) {case '去搜索':case '逛一逛':case '去完成':log("開始【" + task + "】任務")clickButton(button);randomSleep(3000 * speed);if (textContains("復制鏈接").exists()) {log("跳過分享任務");j++;i++;back();sleep(200 * speed);back();break;}if (textContains("淘寶特價版送紅包").exists()) {log("跳過打開APP任務");j++;i++;back();break;}toast(swipeTips);randomSwipe();randomSleep(5000 * speed);toast(swipeTips);randomSwipe();randomSleep(6000 * speed);toast(swipeTips);randomSwipe();descContains("任務完成").findOne(8000 * speed);randomSleep(1000 * speed);i++;log("已完成");back();//支付寶任務返回后需要點擊確認按鈕if (appName == '支付寶') {randomSleep(2000 * speed);clickContent('好的,我知道了');}break;case '去觀看':case '去瀏覽':log("開始【" + task + "】任務")randomSleep(500 * speed);clickButton(button);randomSleep(3000 * speed);if (!textContains("跟主播聊").exists() || !textContains("賺金幣").exists()) {toast(swipeTips);randomSwipe();randomSleep(3500 * speed);toast(swipeTips);randomSwipe();randomSleep(5500 * speed);toast(swipeTips);randomSwipe();} else {randomSleep(15000 * speed);}textContains("全部完成").findOne(8000 * speed);randomSleep(1000 * speed);i++;log("已完成")back();break;case '領取獎勵':case '簽到':case '領取':clickButton(button);randomSleep(1500 * speed);log("【" + task + "】成功")//支付寶任務簽到后需要點擊確認按鈕if (appName == '支付寶') {clickContent('好的,我知道了');}break;default:log("跳過")break;}randomSleep(2000 * speed);}});toastLog("【" + appName + "】任務已完成");log("========================="); }/*** 京東活動腳本*/ function runJd(taskList) {var i = j = 0;var activityButton = "浮層活動";launch("com.jingdong.app.mall");randomSleep(2000 * speed);if (!descContains(activityButton).exists()) {alert("溫馨提示", "首頁沒有找到【全民營業】活動入口浮層\n請手動打開活動頁,進入后腳本會自動執行");} else {clickContent(activityButton, "desc");log("正在打開【京東】活動頁");randomSleep(300 * speed);//部分賬號首頁的活動浮層默認是收起狀態,再次點擊(有時候會點擊失敗,所以用while)while (descContains(activityButton).exists()) {clickContent(activityButton, "desc");randomSleep(300 * speed);}toastLog("若頁面有彈窗,請手動關閉");randomSleep(5000 * speed);}text("領金幣").waitFor();clickContent("領金幣");log("展開任務列表");randomSleep(1000 * speed);//未打開任務列表則再次嘗試點擊while (!textContains("去完成").exists() && !textContains("已完成").exists()) {clickContent("領金幣");randomSleep(300 * speed);}taskList.forEach(task => {while (textContains(task).exists()) {var button = text(task).findOnce(j);if (button == null) {break;}log("開始做第" + (i + 1) + "次任務");switch (task) {case '簽到':jdClickButton(button);log("簽到成功");i++;randomSleep(1000 * speed);break;case '去完成':jdClickButton(button);randomSleep(3000 * speed);if (textContains("口令").exists() && textContains("取消").exists()) {log("跳過助力任務");j++;i++;clickContent("取消");randomSleep(1000 * speed);break;}//若未點擊成功,則再次點擊while (textContains(task).exists()) {jdClickButton(button);randomSleep(300 * speed);}if (textContains("任意瀏覽").exists() || textContains("任意加購").exists() || textContains("聯合開卡").exists() || textContains("商圈紅包").exists()) {log("跳過任務");j++;i++;back();randomSleep(500 * speed);break;}if (textContains("寵汪汪").exists() || textContains("京喜財富島").exists() || textContains("天天加速").exists()) {randomSleep(10000 * speed);} else {randomSleep(2500 * speed);toast(swipeTips);randomSwipe();randomSleep(2200 * speed);toast(swipeTips);randomSwipe();randomSleep(3500 * speed);toast(swipeTips);randomSwipe();}descContains("獲得").findOne(8000 * speed);randomSleep(500 * speed);i++;log("已完成");back();randomSleep(4000 * speed);break;default:log("跳過")break;}}});toastLog("【京東】任務已完成");log("========================="); }/*** 拍貓貓任務* @param num 拍貓貓次數* @param type 任務執行類型:1當前頁面執行,2打開淘寶APP執行*/ function patCat(num, type) {if (type == 1) {clickContent("關閉");} else if (type == 2) {toastLog("打開【淘寶】活動頁");app.startActivity({action: "VIEW",data: taobaoActivityData})}log("開始【拍貓貓】");if (num == 0) {return true;}toastLog("正在瘋狂擼貓中...");for (var i = 0; i < num; i++) {clickContent("我的貓,點擊擼貓", "text", 100);}toastLog("【拍貓貓】任務已完成,共拍貓" + num + "次");log("========================="); }/*** 通過文字內容模擬點擊按鈕* @param content 按鈕文字內容* @param type 點擊類型,默認為text點擊* @param sleepTime 等待時間,默認1000毫秒*/ function clickContent(content, type, sleepTime) {var type = type || "text";var sleepTime = sleepTime || 1000;sleep(sleepTime * float * speed);if (type == "text") {var button = text(content).findOne();} else {var button = desc(content).findOne();}clickButton(button);return button; }/*** 根據控件的坐標范圍隨機模擬點擊* @param button */ function clickButton(button) {var bounds = button.bounds();press(random(bounds.left, bounds.right), random(bounds.top, bounds.bottom), random(50, 350)); }/*** 根據控件的坐標范圍隨機模擬點擊(京東用)* 京東任務按鈕有圓角,通用的隨機點擊方法容易點出圓角外導致點擊失效,此處做修正* @param button */ function jdClickButton(button) {var bounds = button.bounds();var width = bounds.right - bounds.left;press(random(bounds.left + width / 5, bounds.right - width / 5), random(bounds.top, bounds.bottom), random(50, 350)); }/*** 根據float倍數sleep隨機時間* @param time */ function randomSleep(time) {sleep(ramdomByFloat(time)); }/*** 隨機滑動*/ function randomSwipe() {smlMove(ramdomByFloat(width / 2), ramdomByFloat(height / 1.5), ramdomByFloat(width / 2), ramdomByFloat(height / 4), ramdomByFloat(800)); }/*** 范圍隨機數生成* @param min * @param max */ function random(min, max) {return Math.round(Math.random() * (max - min)) + min; }/*** 根據float生成隨機數* @param number */ function ramdomByFloat(number) {return random(number, number * float); }/*** 仿真隨機帶曲線滑動 * @param qx 起點x軸坐標* @param qy 起點y軸坐標* @param zx 終點x軸坐標* @param zy 終點y軸坐標* @param time 滑動時間,毫秒*/ function smlMove(qx, qy, zx, zy, time) {var xxy = [time];var point = [];var dx0 = {"x": qx,"y": qy};var dx1 = {"x": random(qx - 100, qx + 100),"y": random(qy, qy + 50)};var dx2 = {"x": random(zx - 100, zx + 100),"y": random(zy, zy + 50),};var dx3 = {"x": zx,"y": zy};for (var i = 0; i < 4; i++) {eval("point.push(dx" + i + ")");};for (let i = 0; i < 1; i += 0.08) {xxyy = [parseInt(bezierCurves(point, i).x), parseInt(bezierCurves(point, i).y)];xxy.push(xxyy);}gesture.apply(null, xxy); };function bezierCurves(cp, t) {cx = 3.0 * (cp[1].x - cp[0].x);bx = 3.0 * (cp[2].x - cp[1].x) - cx;ax = cp[3].x - cp[0].x - cx - bx;cy = 3.0 * (cp[1].y - cp[0].y);by = 3.0 * (cp[2].y - cp[1].y) - cy;ay = cp[3].y - cp[0].y - cy - by;tSquared = t * t;tCubed = tSquared * t;result = {"x": 0,"y": 0};result.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x;result.y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y;return result; };總結
以上是生活随笔為你收集整理的auto.js 实现信息发送、QQ点赞、微信点赞、健康日报签到的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: win7是什么操作系统(操作系统是什么的
- 下一篇: C语言其实不难,只是你没有找对方法!