-
Notifications
You must be signed in to change notification settings - Fork 69
/
main.js
41 lines (41 loc) · 1.2 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"auto"
var appName = "手机淘宝";
launchApp(appName);
sleep(3000);
//寻找领喵币按钮,存在则执行任务,否则退出脚本
var lingmiaobi = indexInParent(5).depth(18).text("").findOnce();
if (lingmiaobi) {
lingmiaobi.click();
sleep(1000);
execTask();
}
else {
toast("未检查到领喵币按钮")
}
function execTask() {
while(true) {
var target = text("去进店").findOnce() || text("去浏览").findOnce();
if (target == null) {
toast("任务完成");
break;
}
target.click();
sleep(3000);
//浏览网页20s
viewWeb(20);
back();
sleep(1000);
}
}
function viewWeb(time) {
gesture(1000, [300, 600], [300, 300]);
var cnt = 1;
while(true) {
var finish = desc("任务完成").exists() || textStartsWith("已获得").exists();
if (finish || cnt > time) {
break;
}
sleep(1000);
cnt += 1;
}
}