diff --git a/taobao/README.md b/taobao/README.md index f5b29c9..211e39a 100644 --- a/taobao/README.md +++ b/taobao/README.md @@ -1,21 +1,64 @@ -# 淘宝脚本 -欢迎反馈脚本使用问题,兼容安卓6.0 -## 淘宝喵币 -#### 主要功能 -自动点按式完成淘宝喵币收集,第三方工具 [Autojs](apk) -#### 重要更新(10.28) -1. 更友好的提示信息 -2. 增加浏览店铺签到功能 -#### 使用教程 -1. 安装软件 [Autojs](apk) -Autojs是一款安卓脚本自动化模拟用户点按操作apk -2. 导入js -下载 [js](release) 脚本导入到Autojs中,点击运行即可。 -3. 脚本效果 -![使用](picture/use.gif) -## 温馨提示 -1. 使用过程中有一定的延时,可自行调整 sleep() 参数 -2. 操作均由脚本自动跳转设置,勿自行切换页面 -3. 如果页面长时间未反应,可自行进入活动页 -4. 操作完成后会有提示,如果有提示未进行任务则不兼容 -### 期待更多 \ No newline at end of file +# 淘宝脚本 +欢迎反馈脚本使用问题,兼容安卓6.0 +## 淘宝喵币 + +#### 主要功能 +自动点按式完成淘宝喵币收集,第三方工具 [Autojs](apk) + +#### 重要信息 +《[新版流程](./custom/log_3.0.txt)》 《[旧版流程](./custom/log.txt)》 《[组件定制](./custom)》 + +#### 重要更新 +##### 11.07 更新 [直达更新](./release/淘宝喵币3.3.js) +1. 删除冗余代码 +2. 新增[测试模块](./test) +3. 修复定制组件加载问题 + +##### 历史版本 +* 《[淘宝喵币0.1](./release/history/淘宝喵币0.1.js)》 《[淘宝喵币1.0](./release/history/淘宝喵币1.0.js)》 《[淘宝喵币1.1](./release/history/淘宝喵币1.1.js)》 《[淘宝喵币1.2](./release/history/淘宝喵币1.2.js)》 《[淘宝喵币1.3](./release/history/淘宝喵币1.3.js)》 + * 基于坐标点击 + * 升级组件点击 + * 友好的提示信息 + * 增加浏览店铺签到 + * 修正淘宝组件更新 + * 增加任务最大极限时间 + * 多线程统计时间 + * 超时提醒手动操作 + * 更细致化提醒 +* 《[淘宝喵币2.0](./release/history/淘宝喵币2.0.js)》 《[淘宝喵币2.1](./release/history/淘宝喵币2.1.js)》 + * 修正提示信息 + * 修复任务完成不跳转 + * 修正提示信息准确性 + * 更加灵活,组件定制 +* 《[淘宝喵币3.0.1](./release/history/淘宝喵币3.0.1.js)》 《[淘宝喵币3.1](./release/history/淘宝喵币3.1.js)》 《[淘宝喵币3.2](./release/history/淘宝喵币3.2.js)》 《[淘宝喵币3.3](./release/history/淘宝喵币3.3.js)》 + * 定制组件,操作难度增加 + * 增加30个店铺签到功能 + * 界面启用UI设计 + * 兼容更多设备 + * 三天后重新定制组件 + * **首次使用需要定制组件** + * 完善首页控制处理 + * 新增定制组件(主界面底栏的首页组件),31个店铺 + * 更新提示,任务耗时统计 + * 新增店铺浏览滑动操作(仅安卓**7.0以上**设备) + * **新特性即开即用** + * 删除冗余代码 + * 新增[测试模块](./test) + * 修复定制组件加载问题 +* 《[淘宝喵币4.0](./release/history/淘宝喵币4.0.js)》 + * 基本实现了全自动化 + * [测试模块](./test)更新 + * 定制界面优化 + * 可以使用默认配置 + +#### 温馨提示 +1. 使用过程中有一定的延时,可自行调整 sleep() 参数 +2. 操作均由脚本自动跳转设置,勿自行切换页面 +3. 如果页面长时间未反应,可自行进入活动页 +5. **不能运行请按提示注释代码** +#### 致谢 +Autojs是一款安卓脚本自动化模拟用户点按操作apk +2. 导入js +下载 [js](release) 脚本导入到Autojs中,点击运行即可。 +3. 脚本效果 +使用1.x 使用2.x 使用3.x 店铺签到3.x \ No newline at end of file diff --git "a/taobao/apk/Auto.js\346\211\223\345\214\205\346\217\222\344\273\266_4.1.0 Alpha5.apk" "b/taobao/apk/Auto.js\346\211\223\345\214\205\346\217\222\344\273\266_4.1.0 Alpha5.apk" new file mode 100644 index 0000000..f287f1a Binary files /dev/null and "b/taobao/apk/Auto.js\346\211\223\345\214\205\346\217\222\344\273\266_4.1.0 Alpha5.apk" differ diff --git a/taobao/custom/README.md b/taobao/custom/README.md new file mode 100644 index 0000000..7f1d672 --- /dev/null +++ b/taobao/custom/README.md @@ -0,0 +1,18 @@ +# 定制组件 +### 组件信息 +1. className +2. depth +3. indexInParent + +### 重要提示 +1. 文件位置[SD]/喵币定制/customer3.1.conf +2. 可自行改写文件组件 + +### 具体步骤 +1. 打开 [Autojs](../apk) 悬浮窗 +2. 选择布局范围分析 +3. 查找关键组件信息 +4. 点击复制信息 + +### 图片操作 +步骤1 步骤2 步骤3 步骤4 步骤5 步骤6 步骤7 \ No newline at end of file diff --git a/taobao/custom/log.txt b/taobao/custom/log.txt new file mode 100644 index 0000000..e29e93a --- /dev/null +++ b/taobao/custom/log.txt @@ -0,0 +1,16 @@ +活动流程如下: +Rukawalee +淘宝喵币自动完成通知 +提醒:即将自动领取喵币 +准备: com.taobao.taobao +设备:设置长亮. +运行: com.taobao.taobao +准备: com.taobao.tao.TBMainActivity +状态:活动耗时1s +状态:进入主界面中 +状态:活动耗时2s . +准备: android.widget.FrameLayout +状态:进入活动界面中 (提示:这里活动组件还未加载完成) +状态:活动入口加载完成 (提示:这里才正式进入活动) +状态:活动页面加载中 +状态:已进入活动页面 (提示:顺利加载完成) \ No newline at end of file diff --git a/taobao/custom/log_3.0.txt b/taobao/custom/log_3.0.txt new file mode 100644 index 0000000..91ed7fe --- /dev/null +++ b/taobao/custom/log_3.0.txt @@ -0,0 +1,15 @@ +欢迎使用喵币自动收获脚本 +作者: Rukawalee +github.com/Rukawalee/Scripts +设备:设置常亮 +运行:手机淘宝 +准备:手机淘宝主界面.. +设备:缓冲耗时1.5s +状态:进入主界面中.. +状态:查找活动入口组件.. (主界面加载完成) +状态:进入活动页面中.. (双11合伙人加载完成) +提示:如进错页面,请检查组件 +状态:已进入活动页面 (上限加载完成) +准备:领取上限金币 +状态:金币领取成功 +准备:执行活动任务.. (任务按钮加载完成) \ No newline at end of file diff --git a/taobao/custom/log_4.0.txt b/taobao/custom/log_4.0.txt new file mode 100644 index 0000000..cd5ecba --- /dev/null +++ b/taobao/custom/log_4.0.txt @@ -0,0 +1,61 @@ +欢迎使用喵币自动收获脚本 +作者: Rukawalee +github.com/Rukawalee/Scripts +设备:设置常亮 +运行:手机淘宝 +准备:手机淘宝主界面.. +设备:缓冲耗时1.5s +状态:进入首页主页. +状态:查找活动入口组件.. +状态:进入活动页面中.. +提示:如进错页面,请检查组件 +状态:已进入活动页面 +准备:领取上限金币 +状态:金币领取成功 +准备:执行活动任务... +准备:执行签到 +状态:正在执行签到. +状态:完成签到 +准备:领取上限金币 +状态:金币领取成功 +准备:执行去浏览 +状态:正在执行去浏览 +状态:预估任务完成26s +状态:活动耗时2s,预估还需24s +状态:活动耗时2s,预估还需22s +状态:活动耗时2s,预估还需20s +状态:活动耗时2s,预估还需18s +状态:活动耗时2s,预估还需16s +状态:活动耗时2s,预估还需14s . +状态:活动耗时2s,预估还需12s +状态:活动耗时2s,预估还需10s +状态:活动耗时2s,预估还需8s +状态:完成一个任务 +状态:缓冲耗时3s + +...中间重复去浏览 + +准备:执行店铺签到 +设备:缓冲耗时1.5s +状态:进入主界面中.. +状态:进入首页主页 +设备:缓冲耗时2s +准备:查找搜索框.. +准备:签到1个店铺 +状态:正在进入1个店铺 +状态:执行签到领喵币 +准备:签到2个店铺 +状态:正在进入2个店铺 +状态:执行签到领喵币 +准备:签到3个店铺 +状态:正在进入3个店铺 + +...中间重复店铺签到 + +准备:签到31个店铺 +状态:正在进入31个店铺 +状态:执行签到领喵币 +设备:取消常亮 +状态:任务完成 +提示:如任务未完成,请多次尝试! +提示:完成所有任务时间23.77分钟 diff --git a/taobao/picture/settings1.png b/taobao/picture/settings1.png new file mode 100644 index 0000000..9c4b460 Binary files /dev/null and b/taobao/picture/settings1.png differ diff --git a/taobao/picture/settings2.png b/taobao/picture/settings2.png new file mode 100644 index 0000000..f0ba11c Binary files /dev/null and b/taobao/picture/settings2.png differ diff --git a/taobao/picture/settings3.png b/taobao/picture/settings3.png new file mode 100644 index 0000000..26fb1a5 Binary files /dev/null and b/taobao/picture/settings3.png differ diff --git a/taobao/picture/settings4.png b/taobao/picture/settings4.png new file mode 100644 index 0000000..7556b08 Binary files /dev/null and b/taobao/picture/settings4.png differ diff --git a/taobao/picture/settings5.png b/taobao/picture/settings5.png new file mode 100644 index 0000000..1549d54 Binary files /dev/null and b/taobao/picture/settings5.png differ diff --git a/taobao/picture/settings6.png b/taobao/picture/settings6.png new file mode 100644 index 0000000..c7fea99 Binary files /dev/null and b/taobao/picture/settings6.png differ diff --git a/taobao/picture/settings7.png b/taobao/picture/settings7.png new file mode 100644 index 0000000..2c77b46 Binary files /dev/null and b/taobao/picture/settings7.png differ diff --git a/taobao/picture/test/test1.png b/taobao/picture/test/test1.png new file mode 100644 index 0000000..4b8bb8c Binary files /dev/null and b/taobao/picture/test/test1.png differ diff --git a/taobao/picture/test/test2.png b/taobao/picture/test/test2.png new file mode 100644 index 0000000..e595914 Binary files /dev/null and b/taobao/picture/test/test2.png differ diff --git a/taobao/picture/test/test3.png b/taobao/picture/test/test3.png new file mode 100644 index 0000000..3341a4d Binary files /dev/null and b/taobao/picture/test/test3.png differ diff --git a/taobao/picture/test/test4.png b/taobao/picture/test/test4.png new file mode 100644 index 0000000..5e3e072 Binary files /dev/null and b/taobao/picture/test/test4.png differ diff --git a/taobao/picture/test/test5.png b/taobao/picture/test/test5.png new file mode 100644 index 0000000..9e3dd63 Binary files /dev/null and b/taobao/picture/test/test5.png differ diff --git a/taobao/picture/test/test6.png b/taobao/picture/test/test6.png new file mode 100644 index 0000000..9d798a1 Binary files /dev/null and b/taobao/picture/test/test6.png differ diff --git a/taobao/picture/use.gif b/taobao/picture/use1.x.gif similarity index 100% rename from taobao/picture/use.gif rename to taobao/picture/use1.x.gif diff --git a/taobao/picture/use2.x.gif b/taobao/picture/use2.x.gif new file mode 100644 index 0000000..47e3a7e Binary files /dev/null and b/taobao/picture/use2.x.gif differ diff --git a/taobao/picture/use3.x.gif b/taobao/picture/use3.x.gif new file mode 100644 index 0000000..503fc59 Binary files /dev/null and b/taobao/picture/use3.x.gif differ diff --git a/taobao/picture/use_sign3.x.gif b/taobao/picture/use_sign3.x.gif new file mode 100644 index 0000000..363a1c7 Binary files /dev/null and b/taobao/picture/use_sign3.x.gif differ diff --git a/taobao/release/apk_history/error.txt b/taobao/release/apk_history/error.txt new file mode 100644 index 0000000..0abbd94 --- /dev/null +++ b/taobao/release/apk_history/error.txt @@ -0,0 +1,2 @@ +[BUG]多次测试无果,放弃使用 +[BUG]进入主界面停止运行 \ No newline at end of file diff --git "a/taobao/release/apk_history/\346\267\230\345\256\235\345\226\265\345\270\201_v3.0.0.apk" "b/taobao/release/apk_history/\346\267\230\345\256\235\345\226\265\345\270\201_v3.0.0.apk" new file mode 100644 index 0000000..f1c6f75 Binary files /dev/null and "b/taobao/release/apk_history/\346\267\230\345\256\235\345\226\265\345\270\201_v3.0.0.apk" differ diff --git "a/taobao/release/apk_history/\346\267\230\345\256\235\345\226\265\345\270\201_v3.0.1.apk" "b/taobao/release/apk_history/\346\267\230\345\256\235\345\226\265\345\270\201_v3.0.1.apk" new file mode 100644 index 0000000..c1dc20f Binary files /dev/null and "b/taobao/release/apk_history/\346\267\230\345\256\235\345\226\265\345\270\201_v3.0.1.apk" differ diff --git "a/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2010.1.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2010.1.js" new file mode 100644 index 0000000..36ff168 --- /dev/null +++ "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2010.1.js" @@ -0,0 +1,72 @@ +//手机淘宝双11刷喵铺 +//兼容安卓6.0 1080*1920屏 +//做了一部分优化,添加任务完成通知 +auto.waitFor(); +var height = device.height; +var width = device.width; +toast("\n设备宽" + width + "\n" + "设备高" + height + "\n" + "手机型号" + device.model + "\n安卓版本" + device.release); +if (height == 1920) { //设置屏幕高度 + setScreenMetrics(1080, 1920); +} else if (height == 2340) { + setScreenMetrics(1080, 2340); +} else if (height == 2160) { + setScreenMetrics(1080, 2160); +} +device.keepScreenOn(); +work(); +//开始工作 +function work() { + app.launchApp("手机淘宝"); + toast("打开淘宝"); + sleep(8700); + toast("准备进入活动页"); + click(540, 1165, 1054, 1436); //进入活动页 + sleep(12800); + toast("准备进行任务"); + click(808, 1592, 1025, 1817) + sleep(4000); + sign("签到"); + go("去浏览"); + go("去进店"); + sign("去签到"); + device.cancelKeepingAwake(); + notify(); +} +//执行签到 +function sign(str) { + var obj = text(str); + while (obj.exists()) { + toast("准备" + str); + sleep(2500); + obj.findOne().click(); + if (str == "去签到") { + sleep(8000); + click(689,1666,916,1735); + back(); + } + toast("签到成功"); + sleep(2500); + } +} +//执行任务 +function go(str) { + var obj = text(str); + while (obj.exists()) { + obj.findOne().click(); + toast("准备" + str); + //等待任务时间 + sleep(22800); + toast("完成一个任务"); + back(); + sleep(2500); + } +} +//执行通知 +function notify() { + var times = 3; + while (times-- > 1) { + device.vibrate(30 + times * 6); + sleep(128); + } + toast("任务完成!"); +} \ No newline at end of file diff --git "a/taobao/release/\346\267\230\345\256\235\345\226\265\345\270\2011.1.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.1.js" similarity index 100% rename from "taobao/release/\346\267\230\345\256\235\345\226\265\345\270\2011.1.js" rename to "taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.1.js" diff --git "a/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.2.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.2.js" new file mode 100644 index 0000000..c4148d5 --- /dev/null +++ "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.2.js" @@ -0,0 +1,240 @@ +var curr = "com.taobao.taobao"; +var home = "com.taobao.tao.TBMainActivity"; +var act = "android.widget.FrameLayout"; +var view = "android.view.View"; +var btn = "android.widget.Button"; + +function collectCoin(str) { + var obj = textContains(str); + if (obj.exists()) { + log("状态:领取金币"); + log("状态:活动耗时0.5s"); + sleep(500); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + log("状态:金币领取成功"); + sudden(text("开心收下")); + sleep(1000); + } +} + +function sudden(obj) { + log("状态:活动耗时2s"); + sleep(2000); + if (obj.exists()) { + log("状态:意外情况,已自动处理"); + obj.findOne().click(); + } +} + +function doTask(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + obj.findOne().click(); + switch (str) { + case "翻倍领取": + toFind(view, "", "观看完成", "").waitFor(); + break; + case "去浏览": + case "去进店": + var limit = 28; + log("状态:预计完成任务需:" + limit + "s") + while (true) { + sleep(2000); + limit -= 2; + log("状态:活动耗时2s,预计还需:" + limit + "s"); + if (limit <= 0 || + textContains("任务完成").exists() || + textContains("已获得").exists() || + textContains("已达上限").exists() || + toFind(view, "", "已获得", "").exists() || + toFind(view, "", "任务完成", "").exists() || + toFind(view, "", "已达上限", "").exists()) { + break; + } + } + signTo(toFind(view, "", "签到领喵币", "")); + isHome(); + break; + default: + sleep(22800); + break; + } + log("提示:如页面快速跳转,请手动切换任务"); + toast("完成一个任务"); + back(); + sleep(3000); + collectCoin(); + } +} + +function dob() { + collectCoin("上限"); + sleep(1000); + if (text("翻倍领取").exists()) { + log("准备:执行任务翻倍领取"); + doTask("翻倍领取"); + } +} + +function signTo(obj) { + if (obj.exists()) { + log("状态:签到领喵币"); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + sleep(2000); + } +} + +function isHome() { + if (currentActivity() == home) { + log("准备:重新进入活动页"); + scrollUp(); + sleep(1000); + timeout(8000, currentActivity()); + toAct(act); + } +} + +function sign(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + log("状态:活动耗时1s"); + sleep(1000); + obj.findOne().click(); + if (str == "去签到") { + sleep(8000); + tar = toFind(view, "", "马上签到", ""); + if (!tar.exists()) { + tar = textContains("去完成"); + log("提示:目标任务请手动完成"); + notify(); + break; + } + tar.waitFor(); + tar.findOne().click(); + log("状态:活动耗时1.5s"); + sleep(1500); + log("准备:返回至活动界面"); + back(); + } + log("状态:签到完成"); + log("状态:活动耗时3.5s"); + sleep(3500); + } +} + +function toCollect() { + dob(); + log("准备:进行活动任务"); + toFind(btn, 14, "", 5).findOne().click(); + log("状态:活动耗时3s"); + sleep(3000); + log("准备:执行任务签到"); + sign("签到"); + dob(); + log("准备:执行任务去浏览"); + doTask("去浏览"); + dob(); + log("准备:执行任务去进店"); + doTask("去进店"); + dob(); + log("准备:执行任务去签到"); + sign("去签到"); +} + +function loadApp(appName) { + log("准备:" + appName); + sleep(1000); + log("设备:设置长亮"); + device.keepScreenOn(); + log("运行:" + appName); + launch(appName); + log("准备:" + home); + toHome(home); +} + +function toHome(appHome) { + log("状态:活动耗时1s"); + sleep(1000); + while (currentActivity() != appHome) { + log("状态:进入主界面中"); + back(); + log("状态:活动耗时2s"); + sleep(2000); + } + toAct(act); +} + +function timeout(time, active) { + var id = setInterval(function() { + if (currentActivity() == active) { + log("等待超时,请手动进入活动界面"); + notify(); + } + clearInterval(id); + }, time); +} + +function toAct(actIn) { + log("准备:" + actIn); + sleep(1000); + log("状态:进入活动界面中"); + timeout(8000, currentActivity()); + toFind(actIn, 3, "", 1).findOne().click(); + log("状态:活动入口加载完成"); + log("状态:活动页面加载中"); + timeout(8000, currentActivity()); + textContains("上限").waitFor(); + log("状态:已进入活动页面"); + toCollect(); +} + +function notify() { + var times = 3; + while (times-- > 1) { + device.vibrate(30 + times * 6); + sleep(128); + } +} + +function over() { + log("设备:", "取消设备长亮"); + device.cancelKeepingAwake(); + log("状态:任务完成,震动通知"); + toast("任务已完成"); + log("提示:出现此通知表示完成任务" + + "如果任务未完成,可多次尝试," + + "如果多次尝试后仍然出现表示不兼容"); +} + + +function toFind(cls, depth, desc, indexInParent) { + var obj = className(cls).clickable(true); + if (depth != "") { + obj = obj.depth(depth); + } + if (desc != "") { + obj = obj.descContains(desc); + } + if (indexInParent != "") { + obj = obj.indexInParent(indexInParent); + } + return obj; +} + +function main() { + log("Rukawalee"); + log("淘宝喵币自动完成通知"); + sleep(2000); + log("提醒:即将进入自动领取喵币"); + loadApp(curr); + notify(); + over(); + exit(); +} +auto.waitFor(); +console.show(); +main(); \ No newline at end of file diff --git "a/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.3.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.3.js" new file mode 100644 index 0000000..83f2261 --- /dev/null +++ "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2011.3.js" @@ -0,0 +1,244 @@ +var curr = "com.taobao.taobao"; +var home = "com.taobao.tao.TBMainActivity"; +var act = "android.widget.FrameLayout"; +var view = "android.view.View"; +var btn = "android.widget.Button"; + +function collectCoin(str) { + var obj = textContains(str); + if (obj.exists()) { + log("状态:领取金币"); + log("状态:活动耗时0.5s"); + sleep(500); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + log("状态:金币领取成功"); + sudden(text("开心收下")); + sleep(1000); + } +} + +function sudden(obj) { + log("状态:活动耗时2s"); + sleep(2000); + if (obj.exists()) { + log("状态:意外情况,已自动处理"); + obj.findOne().click(); + } +} + +function doTask(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + obj.findOne().click(); + switch (str) { + case "翻倍领取": + toFind(view, "", "观看完成", "").waitFor(); + break; + case "去浏览": + case "去进店": + var limit = 28; + log("状态:预计完成任务需:" + limit + "s") + while (true) { + sleep(2000); + limit -= 2; + log("状态:活动耗时2s,预计还需" + limit + "s"); + if (limit <= 0 || + textContains("任务完成").exists() || + textContains("已获得").exists() || + textContains("已达上限").exists() || + toFind(view, "", "已获得", "").exists() || + toFind(view, "", "任务完成", "").exists() || + toFind(view, "", "已达上限", "").exists()) { + break; + } + } + signTo(toFind(view, "", "签到领喵币", "")); + isHome(); + break; + default: + sleep(22800); + break; + } + log("提示:如页面快速跳转,请手动切换任务"); + toast("完成一个任务"); + back(); + sleep(3000); + collectCoin(); + } +} + +function dob() { + collectCoin("上限"); + sleep(1000); + if (text("翻倍领取").exists()) { + log("准备:执行任务翻倍领取"); + doTask("翻倍领取"); + } +} + +function signTo(obj) { + if (obj.exists()) { + log("状态:签到领喵币"); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + sleep(2000); + } +} + +function isHome() { + if (currentActivity() == home) { + log("准备:重新进入活动页"); + scrollUp(); + sleep(1000); + toAct(act); + } +} + +function sign(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + log("状态:活动耗时1s"); + sleep(1000); + obj.findOne().click(); + if (str == "去签到") { + sleep(8000); + tar = toFind(view, "", "马上签到", ""); + if (!tar.exists()) { + tar = textContains("去完成"); + log("提示:目标任务请手动完成"); + notify(); + break; + } + tar.waitFor(); + tar.findOne().click(); + log("状态:活动耗时1.5s"); + sleep(1500); + log("准备:返回至活动界面"); + back(); + } + log("状态:签到完成"); + log("状态:活动耗时3.5s"); + sleep(3500); + } +} + +function toCollect() { + dob(); + log("准备:进行活动任务"); + toFind(btn, 14, "", 5).findOne().click(); + log("状态:活动耗时3s"); + sleep(3000); + log("准备:执行任务签到"); + sign("签到"); + dob(); + log("准备:执行任务去浏览"); + doTask("去浏览"); + dob(); + log("准备:执行任务去进店"); + doTask("去进店"); + dob(); + log("准备:执行任务去签到"); + sign("去签到"); +} + +function loadApp(appName) { + log("准备:" + appName); + sleep(1000); + log("设备:设置长亮"); + device.keepScreenOn(); + log("运行:" + appName); + launch(appName); + log("准备:" + home); + toHome(home); +} + +function toHome(appHome) { + log("状态:活动耗时1s"); + sleep(1000); + while (currentActivity() != appHome) { + log("状态:进入主界面中"); + back(); + log("状态:活动耗时2s"); + sleep(2000); + } + toAct(act); +} + +function timeout(time, active) { + return threads.start(function() { + var id = setInterval(function() { + if (currentActivity() == active) { + log("等待超时,请手动点击{双11合伙人}活动界面"); + notify(); + } else { + clearInterval(id); + } + }, time); + }); +} + +function toAct(actIn) { + log("准备:" + actIn); + sleep(1000); + log("状态:进入活动界面中"); + var subThread = timeout(8000, currentActivity()); + toFind(actIn, 3, "", 1).findOne().click(); + subThread.interrupt(); + log("状态:活动入口加载完成"); + log("状态:活动页面加载中"); + subThread = timeout(8000, currentActivity()); + textContains("上限").waitFor(); + subThread.interrupt(); + log("状态:已进入活动页面"); + toCollect(); +} + +function notify() { + var times = 3; + while (times-- > 1) { + device.vibrate(30 + times * 6); + sleep(128); + } +} + +function over() { + log("设备:", "取消设备长亮"); + device.cancelKeepingAwake(); + log("状态:任务完成,震动通知"); + toast("任务已完成"); + log("提示:出现此通知表示完成任务" + + "如果任务未完成,可多次尝试," + + "如果多次尝试后仍然出现表示不兼容"); +} + + +function toFind(cls, depth, desc, indexInParent) { + var obj = className(cls).clickable(true); + if (depth != "") { + obj = obj.depth(depth); + } + if (desc != "") { + obj = obj.descContains(desc); + } + if (indexInParent != "") { + obj = obj.indexInParent(indexInParent); + } + return obj; +} + +function main() { + log("Rukawalee"); + log("淘宝喵币自动完成通知"); + sleep(2000); + log("提醒:即将自动领取喵币"); + loadApp(curr); + notify(); + over(); + exit(); +} +auto.waitFor(); +console.show(); +main(); \ No newline at end of file diff --git "a/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2012.0.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2012.0.js" new file mode 100644 index 0000000..2e4464c --- /dev/null +++ "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2012.0.js" @@ -0,0 +1,294 @@ +var curr = "com.taobao.taobao"; +var home = "com.taobao.tao.TBMainActivity"; +var act = "android.widget.FrameLayout"; +var view = "android.view.View"; +var btn = "android.widget.Button"; +var c_className = act; +var c_depth = 3; +var c_indexInParent = 1; +var c_btn = btn; +var c_btn_depth = 14; +var c_btn_indexInParent = 5; +var f_name = "./custom.conf"; + +function collectCoin(str) { + var obj = textContains(str); + if (obj.exists()) { + log("状态:领取金币"); + log("状态:活动耗时0.5s"); + sleep(500); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + log("状态:金币领取成功"); + sudden(text("开心收下")); + sleep(1000); + } +} + +function sudden(obj) { + log("状态:活动耗时2s"); + sleep(2000); + if (obj.exists()) { + log("状态:意外情况,已自动处理"); + obj.findOne().click(); + } +} + +function doTask(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + obj.findOne().click(); + switch (str) { + case "翻倍领取": + toFind(view, "", "观看完成", "").waitFor(); + break; + case "去浏览": + case "去进店": + var limit = 28; + log("状态:预计完成任务需:" + limit + "s"); + while (true) { + sleep(2000); + limit -= 2; + log("状态:活动耗时2s,预计还需" + limit + "s"); + if (limit <= 0 || textContains("任务完成").exists() || textContains("已获得").exists() || textContains("已达上限").exists() || toFind(view, "", "已获得", "").exists() || toFind(view, "", "任务完成", "").exists() || toFind(view, "", "已达上限", "").exists()) { + break; + } + } + signTo(toFind(view, "", "签到领喵币", "")); + isHome(); + break; + default: + sleep(22800); + break; + } + log("提示:如页面快速跳转,请手动切换任务"); + toast("完成一个任务"); + back(); + sleep(3000); + collectCoin(); + } +} + +function dob() { + collectCoin("上限"); + sleep(1000); + if (text("翻倍领取").exists()) { + log("准备:执行任务翻倍领取"); + doTask("翻倍领取"); + } +} + +function signTo(obj) { + if (obj.exists()) { + log("状态:签到领喵币"); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + sleep(2000); + } +} + +function isHome() { + if (currentActivity() == home) { + log("准备:重新进入活动页"); + scrollUp(); + sleep(1000); + toAct(act); + } +} + +function sign(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + log("状态:活动耗时1s"); + sleep(1000); + obj.findOne().click(); + if (str == "去签到") { + sleep(8000); + tar = toFind(view, "", "马上签到", ""); + if (!tar.exists()) { + tar = textContains("去完成"); + log("提示:目标任务请手动完成"); + notify(); + break; + } + tar.waitFor(); + tar.findOne().click(); + log("状态:活动耗时1.5s"); + sleep(1500); + log("准备:返回至活动界面"); + back(); + } + log("状态:签到完成"); + log("状态:活动耗时3.5s"); + sleep(3500); + } +} + +function toCollect() { + dob(); + log("准备:进行活动任务"); + toFind(btn, 14, "", 5).findOne().click(); + log("状态:活动耗时3s"); + sleep(3000); + log("准备:执行任务签到"); + sign("签到"); + dob(); + log("准备:执行任务去浏览"); + doTask("去浏览"); + dob(); + log("准备:执行任务去进店"); + doTask("去进店"); + dob(); + log("准备:执行任务去签到"); + sign("去签到"); +} + +function loadApp(appName) { + log("准备:" + appName); + sleep(1000); + log("设备:设置长亮"); + device.keepScreenOn(); + log("运行:" + appName); + launch(appName); + log("准备:" + home); + toHome(home); +} + +function toHome(appHome) { + log("状态:活动耗时1s"); + sleep(1000); + while (currentActivity() != appHome) { + log("状态:进入主界面中"); + back(); + log("状态:活动耗时2s"); + sleep(2000); + } + toAct(act); +} + +function timeout(time, active, tip) { + return threads.start(function() { + var id = setInterval(function() { + if (currentActivity() == active) { + log("等待超时," + tip); + notify(); + } else { + clearInterval(id); + } + }, time); + }); +} + +function toAct(actIn) { + log("准备:" + actIn); + sleep(1000); + log("状态:进入活动界面中"); + var subThread = timeout(8000, currentActivity(), "请手动点击{双11合伙人}活动界面"); + toFind(c_className, c_depth, "", c_indexInParent).findOne().click(); + subThread.interrupt(); + log("状态:活动入口加载完成"); + log("状态:活动页面加载中"); + subThread = timeout(8000, currentActivity(), "{上限}被遮挡"); + textContains("上限").waitFor(); + subThread.interrupt(); + log("状态:已进入活动页面"); + toCollect(); +} + +function notify() { + var times = 3; + while (times-- > 1) { + device.vibrate(30 + times * 6); + sleep(128); + } +} + +function over() { + log("设备:", "取消设备长亮"); + device.cancelKeepingAwake(); + log("状态:任务完成,震动通知"); + toast("任务已完成"); + log("提示:出现此通知表示完成任务" + "如果任务未完成,可多次尝试," + "如果多次尝试后仍然出现表示不兼容"); +} + +function toFind(cls, depth, desc, indexInParent) { + var obj = className(cls).clickable(true); + if (depth != "") { + obj = obj.depth(depth); + } + if (desc != "") { + obj = obj.descContains(desc); + } + if (indexInParent != "") { + obj = obj.indexInParent(indexInParent); + } + return obj; +} + +function custom() { + var is_custom = dialogs.rawInput("是否定制组件信息", "是/否"); + switch (is_custom) { + case "是": + c_className = dialogs.rawInput("输入{双11合伙人}className:", act); + c_depth = dialogs.input("输入{双11合伙人}depth:", 3); + c_indexInParent = dialogs.input("输入{双11合伙人}indexInParent:", 1); + c_btn = dialogs.rawInput("请输入{领金币}className:", c_btn); + c_btn_depth = dialogs.input("请输入{领金币}depth:", c_btn_depth); + c_btn_indexInParent = dialogs.input("请输入{领金币}indexInParent:", c_btn_indexInParent); + var pw = open(f_name, "w", "utf-8"); + pw.writeline(c_className + "," + c_depth + "," + c_indexInParent); + pw.writeline(c_btn + "," + c_btn_depth + "," + c_btn_indexInParent); + pw.flush(); + pw.close(); + log("定制信息已保存至custom.conf"); + break; + case "否": + history(); + break; + default: + toast("提示:输入内容有误"); + custom(); + break; + } +} + +function history() { + if (files.exists(f_name)) { + var pr = open(f_name, "r", "utf-8"); + var component = ""; + var i = 0; + while ((component = pr.readline()) != null) { + var values = component.split(","); + if (i == 0) { + c_className = values[0]; + c_depth = values[1]; + c_indexInparent = values[2]; + } else { + c_btn = values[0]; + c_btn_depth = values[1]; + c_btn_indexInparent = values[2]; + } + i++; + } + pr.close(); + return; + } + toast("提示:不存在历史定制,将使用默认值"); +} + +function main() { + log("Rukawalee"); + log("淘宝喵币自动完成通知"); + sleep(2000); + log("提醒:即将自动领取喵币"); + loadApp(curr); + notify(); + over(); + exit(); +} +auto.waitFor(); +console.show(); +custom(); +main(); \ No newline at end of file diff --git "a/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2012.1.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2012.1.js" new file mode 100644 index 0000000..8fbe855 --- /dev/null +++ "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2012.1.js" @@ -0,0 +1,313 @@ +var curr = "com.taobao.taobao"; +var home = "com.taobao.tao.TBMainActivity"; +var act = "android.widget.FrameLayout"; +var view = "android.view.View"; +var btn = "android.widget.Button"; +var c_className = act; +var c_depth = 3; +var c_indexInParent = 1; +var c_btn = btn; +var c_btn_depth = 14; +var c_btn_indexInParent = 5; +var f_name = "./custom.conf"; + +function collectCoin(str) { + var obj = textContains(str); + if (obj.exists()) { + log("状态:领取金币"); + log("状态:活动耗时0.5s"); + sleep(500); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + log("状态:金币领取成功"); + sudden(text("收下去盖楼")); + sleep(1000); + } +} + +function sudden(obj) { + log("状态:活动耗时2s"); + sleep(2000); + if (obj.exists()) { + log("状态:意外情况,请手动关闭"); + //obj.findOne().click(); + } +} + +function wait(limit) { + log("状态:预计完成任务需:" + limit + "s"); + while (true) { + sleep(2000); + limit -= 2; + var condition = false; + for (var i = 1; i < arguments.length; i++) { + if (arguments[i].exists()) { + condition = true; + break; + } + } + log("状态:活动耗时2s,预计还需" + limit + "s"); + if (limit <= 0 || condition) { + break; + } + } +} + +function doTask(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + obj.findOne().click(); + switch (str) { + case "翻倍领取": + wait(24, toFind(view, "", "观看完成", "", "")); + break; + case "去浏览": + case "去进店": + wait(26, textContains("任务完成"), + textContains("任务已完成"), + textContains("已获得"), + textContains("已达上限"), + toFind(view, "", "已获得", "", ""), + toFind(view, "", "任务完成", "", ""), + toFind(view, "", "任务已完成", "", ""), + toFind(view, "", "已达上限", "", "")); + signTo(toFind(view, "", "签到领喵币", "", "")); + isHome(); + break; + default: + sleep(22800); + break; + } + log("提示:如页面快速跳转,请手动切换任务"); + toast("完成一个任务"); + back(); + sleep(3000); + } +} + +function dob() { + collectCoin("上限"); + sleep(1000); + if (text("翻倍领取").exists()) { + log("准备:执行任务翻倍领取"); + doTask("翻倍领取"); + } +} + +function signTo(obj) { + if (obj.exists()) { + log("状态:签到领喵币"); + var rect = obj.findOne().bounds(); + click(rect.left, rect.top, rect.right, rect.bottom); + sleep(2000); + } +} + +function isHome() { + if (currentActivity() == home) { + log("准备:重新进入活动页"); + scrollUp(); + sleep(1000); + toAct(act); + } +} + +function sign(str) { + var obj = text(str); + while (obj.exists()) { + log("状态:执行任务" + str); + log("状态:活动耗时1s"); + sleep(1000); + obj.findOne().click(); + if (str == "去签到") { + sleep(8000); + tar = toFind(view, "", "马上签到", "", true); + if (!tar.exists()) { + tar = textContains("去完成"); + log("提示:目标任务请手动完成"); + notify(); + break; + } + tar.waitFor(); + tar.findOne().click(); + log("状态:活动耗时1.5s"); + sleep(1500); + log("准备:返回至活动界面"); + back(); + } + log("状态:签到完成"); + log("状态:活动耗时3.5s"); + sleep(3500); + } +} + +function toCollect() { + dob(); + log("准备:进行活动任务"); + toFind(btn, c_btn_depth, "", c_btn_indexInParent, true).findOne().click(); + log("状态:活动耗时3s"); + sleep(3000); + log("准备:执行任务签到"); + sign("签到"); + dob(); + log("准备:执行任务去浏览"); + doTask("去浏览"); + dob(); + log("准备:执行任务去进店"); + doTask("去进店"); + dob(); + log("准备:执行任务去签到"); + sign("去签到"); +} + +function loadApp(appName) { + log("准备:" + appName); + sleep(1000); + log("设备:设置长亮"); + device.keepScreenOn(); + log("运行:" + appName); + launch(appName); + log("准备:" + home); + toHome(home); +} + +function toHome(appHome) { + log("状态:活动耗时1s"); + sleep(1000); + while (currentActivity() != appHome) { + log("状态:进入主界面中"); + back(); + log("状态:活动耗时2s"); + sleep(2000); + } + toAct(act); +} + +function timeout(time, active, tip) { + return threads.start(function() { + var id = setInterval(function() { + if (currentActivity() == active) { + log("等待超时," + tip); + notify(); + } else { + clearInterval(id); + } + }, time); + }); +} + +function toAct(actIn) { + log("准备:" + actIn); + sleep(1000); + log("状态:进入活动界面中"); + var subThread = timeout(8000, currentActivity(), "请查找{双11合伙人}重新进入活动"); + toFind(c_className, c_depth, "", c_indexInParent, true).findOne().click(); + subThread.interrupt(); + log("状态:活动入口加载完成"); + log("状态:活动页面加载中"); + subThread = timeout(8000, currentActivity(), "请查找{双11合伙人}重新进入活动"); + textContains("上限").waitFor(); + subThread.interrupt(); + log("状态:已进入活动页面"); + toCollect(); +} + +function notify() { + var times = 3; + while (times-- > 1) { + device.vibrate(30 + times * 6); + sleep(128); + } +} + +function over() { + log("设备:", "取消设备长亮"); + device.cancelKeepingAwake(); + log("状态:任务完成,震动通知"); + toast("任务已完成"); + log("提示:出现此通知表示完成任务" + "如果任务未完成,可多次尝试," + "如果多次尝试后仍然出现表示不兼容"); +} + +function toFind(cls, depth, desc, indexInParent, clickable) { + var obj = className(cls); + if (depth != "") { + obj = obj.depth(depth); + } + if (desc != "") { + obj = obj.descContains(desc); + } + if (indexInParent != "") { + obj = obj.indexInParent(indexInParent); + } + if (clickable != "") { + obj = obj.clickable(clickable); + } + return obj; +} + +function custom() { + var is_custom = dialogs.rawInput("是否定制组件信息", "否"); + switch (is_custom) { + case "是": + c_className = dialogs.rawInput("输入{双11合伙人}className:", act); + c_depth = dialogs.input("输入{双11合伙人}depth:", 3); + c_indexInParent = dialogs.input("输入{双11合伙人}indexInParent:", 1); + c_btn = dialogs.rawInput("请输入{领金币}className:", c_btn); + c_btn_depth = dialogs.input("请输入{领金币}depth:", c_btn_depth); + c_btn_indexInParent = dialogs.input("请输入{领金币}indexInParent:", c_btn_indexInParent); + var pw = open(f_name, "w", "utf-8"); + pw.writeline(c_className + "," + c_depth + "," + c_indexInParent); + pw.writeline(c_btn + "," + c_btn_depth + "," + c_btn_indexInParent); + pw.flush(); + pw.close(); + log("定制信息已保存至custom.conf"); + break; + case "否": + history(); + break; + default: + toast("提示:输入内容有误"); + custom(); + break; + } +} + +function history() { + if (files.exists(f_name)) { + var pr = open(f_name, "r", "utf-8"); + var component = ""; + var i = 0; + while ((component = pr.readline()) != null) { + var values = component.split(","); + if (i == 0) { + c_className = values[0]; + c_depth = values[1]; + c_indexInparent = values[2]; + } else { + c_btn = values[0]; + c_btn_depth = values[1]; + c_btn_indexInparent = values[2]; + } + i++; + } + pr.close(); + return; + } + toast("提示:不存在历史定制,将使用默认值"); +} + +function main() { + log("Rukawalee"); + log("淘宝喵币自动完成通知"); + sleep(2000); + log("提醒:即将自动领取喵币"); + loadApp(curr); + notify(); + over(); + exit(); +} +auto.waitFor(); +console.show(); +custom(); +main(); \ No newline at end of file diff --git "a/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2013.0.1.js" "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2013.0.1.js" new file mode 100644 index 0000000..88cea57 --- /dev/null +++ "b/taobao/release/history/\346\267\230\345\256\235\345\226\265\345\270\2013.0.1.js" @@ -0,0 +1,493 @@ +"ui"; +var app = "com.taobao.taobao"; +var home = "com.taobao.tao.TBMainActivity"; +var act = "com.taobao.browser.BrowserActivity"; +var actCom = "android.widget.FrameLayout"; +var actDepth = 3; +var actIndexInParent = 1; +var taskBtn = "android.widget.Button"; +var taskDepth = 14; +var taskIndexInParent = 5; +var view = "android.view.View"; +var searchHome = "com.taobao.search.searchedoor.SearcheDorrActivity"; +var editText = "android.widget.EditText"; +var editDepth = 2; +var editIndexInParent = 0; +var searchBtn = taskBtn; +var homeSearch = view; +var homeSearchDepth = 1; +var homeSearchIndexInParent = 8; +var confFile = files.getSdcardPath() + "/喵币定制/customer.conf"; +var time = 0; +var stores = ["&userId=2089100916&shopId=111481369&pathInfo=/campaign-10827-88.htm#tq", + "&userId=1035757927&shopId=73516010&pathInfo=/campaign-10827-113.htm#tq", + "&userId=519286239&shopId=62832501&pathInfo=/campaign-10827-128.htm#tq", + "&userId=3079263591&shopId=289321551&pathInfo=/campaign-10827-92.htm#tq", + "&userId=2374579403&shopId=116386742&pathInfo=/campaign-10827-79.htm#tq", + "&userId=2838892713&shopId=150920153&pathInfo=/campaign-10827-142.htm#tq", + "&userId=2360209412&shopId=115862174&pathInfo=/campaign-10827-105.htm#tq", + "&userId=201749140&shopId=57616696&pathInfo=/campaign-10827-117.htm#tq", + "&userId=134363478&shopId=57301407&pathInfo=/campaign-10827-248.htm#tq", + "&userId=92688455&shopId=57299736&pathInfo=/campaign-10827-148.htm#tq", + "&userId=1790973264&shopId=106746477&pathInfo=/campaign-10827-85.htm#tq", + "&userId=890482188&shopId=71955116&pathInfo=/campaign-10827-125.htm#tq", + "&userId=749391658&shopId=68491548&pathInfo=/campaign-10827-127.htm#tq", + "&userId=1114511827&shopId=101717810&pathInfo=/campaign-10827-144.htm#tq", + "&userId=917264765&shopId=72571314&pathInfo=/campaign-10827-100.htm#tq", + "&userId=160586276&shopId=57301770&pathInfo=/campaign-10827-75.htm#tq", + "&userId=1714128138&shopId=104736810&pathInfo=/campaign-10827-276.htm#tq", + "&userId=2228361831&shopId=113462750&pathInfo=/campaign-10827-511.htm#tq", + "&userId=3164711246&shopId=306660112&pathInfo=/campaign-10827-61.htm#tq", + "&userId=901409638&shopId=72217984&pathInfo=/campaign-10827-91.htm#tq", + "&userId=3626596873&shopId=471050084&pathInfo=/campaign-10827-46.htm#tq", + "&userId=3527212490&shopId=434208197&pathInfo=/campaign-10827-47.htm#tq", + "&userId=533497499&shopId=62941831&pathInfo=/campaign-10827-111.htm#tq", + "&userId=883737303&shopId=71799145&pathInfo=/campaign-10827-107.htm#tq", + "&userId=2957642769&shopId=329012182&pathInfo=/campaign-10827-46.htm#tq", + "&userId=2064892827&shopId=110224300&pathInfo=/campaign-10827-107.htm#tq", + "&userId=446338500&shopId=62147762&pathInfo=/campaign-10827-171.htm#tq", + "&userId=470168984&shopId=62377409&pathInfo=/campaign-10827-130.htm#tq", + "&userId=1652554937&shopId=103715363&pathInfo=/campaign-10827-106.htm#tq", + "&userId=217101303&shopId=57895461&pathInfo=/campaign-10827-499.htm#tq"]; + +importClass(com.stardust.autojs.core.ui.JsViewHelper); + +function UI(){ + ui.layout( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +