forked from Mister-Kin/AutojsScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjingdong.js
More file actions
37 lines (36 loc) · 1.33 KB
/
jingdong.js
File metadata and controls
37 lines (36 loc) · 1.33 KB
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
// ----------------------------
// 脚本信息设定
let task_name = "京东签到"
let app_name = "京东"
// ----------------------------
let common = require('common.js')
common.startLog(task_name)
common.runApp(app_name)
// ----------------------------
// 脚本自定义函数
getDailyBeans()
// ----------------------------
common.stopApp(app_name)
common.endLog(task_name)
home()
exit()
function getDailyBeans() {
let detect_get_beans_button = common.detectWidgetItem("textContains", "秒杀", "error", "normal")
if (detect_get_beans_button) {
detect_get_beans_button.parent().click()
setScreenMetrics(1080, 2412)
common.sml_mov(900, 100, 950, 150, 1000)
let detect_sign_to_get_beans_button = common.detectWidgetItem("textContains", "签到领豆", "none", "normal")
if (detect_sign_to_get_beans_button) {
click(540, detect_sign_to_get_beans_button.bounds().top + detect_sign_to_get_beans_button.bounds().height() * 3 / 4)
}
// TODO:改进领取成功的判断
let detect_get_more_beans_button = common.detectWidgetItemWithChain("android.widget.TextView", 20, 0, 1, "error", "lite")
if (detect_get_more_beans_button) {
console.log("已领取「京豆」")
}
else {
console.log("未领取到「京豆」")
}
}
}