forked from xiaorui16888/AutoJsCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.js
84 lines (80 loc) · 1.63 KB
/
2.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
pat = "/storage/emulated/0/自动精灵/图.zjs"
if (!requestScreenCapture()) {
toast("请求截图失败");
exit();
}
a = dq(pat)
b = a.split("\r\n");
b.pop();
b.shift();
//console.show()
for(i in b){
bb = b[i]
//bb=b[b.length-1]
c = JSON.parse(bb);
k = c.type
log(k)
eval(k + "(c)")
if(k=="点击图片"){
var sm_img = images.fromBase64(img_base64)
while (true) {
var img = captureScreen();
var point = findImage(img, sm_img);
log(point);
if (point == null) {
//sm_img.recycle();
img.recycle();
} else {
press(point.x+(w/2),point.y+(h/2),16);
break;
}
sleep(200);
}
}
sleep(500)
}
function 点击图片(c) {
img_base64 = c.posData.imageData.data
w=c.posData.imageData.imageWidth
h=c.posData.imageData.imageHeight
to_jump = c.jumpToPosition
cs = c.repeatCount
log(to_jump, cs,w,h)
}
function 点击(c) {
x = Math.round(c.posData.x.split("%")[0] / 100 * 1080)
y = Math.round(c.posData.y.split("%")[0] / 100 * 2261)
tim = c.duration
if (tim = "undefined") {
tim = 100
}
tie = c.delay
if (tie = "undefined") {
tie = 1000
}
// return [x,y,tim,tie]
sleep(tie)
press(x, y, tim)
}
function dq(k) {
let file = open(k);
let text = file.read();
return text;
file.close();
};
function kk(mm) {
for (i in mm) {
df = mm[i]
as = typeof(df);
sd = df.toString().length
if (sd > 50 || as == "object") {
df = "太多了"
}
setClip(i)
log(i, as, df)
if (as == "object") {
kk(mm[i]);
};
sleep(200)
}
}