学习通刷学习次数

脚本运行不稳定。运行时请将控制台窗口最小化。

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
auto();
console.show(true)
console.setTitle("智慧树自动学习", "#058dff", 40);
console.setCanInput(false);
console.setLogSize(18);
console.setPosition(150, 500);

console.log("1.请前往autoxjs设置音量上键关闭所有脚本");
console.log("2.重要:请将控制台窗口最小化,否则会点击错误,脚本异常");
// console.log("3.当您退出学习通时,脚本自动结束");
console.log("4.脚本失效,bug及时反馈");


console.info(Ftime() + " 启动成功!");
toast("启动成功!")
randomTime(3000)

var thread = threads.start(() => {


while (1) {
randomTime()

let 章节标题集合 = id("tv_title").find()
// if(){}
console.log("找到任务点个数:" + 章节标题集合.size());
randomTime()
toast("找到任务点")



let 随机章节下标 = Math.floor(Math.random() * 章节标题集合.size())

console.log("打开第" + 随机章节下标 + "个任务点");
randomTime()


if (章节标题集合[随机章节下标] == undefined) {
console.log("任务点打开失败,循环重新开始");
continue
}

toast("打开任务点")
click_pro(章节标题集合[随机章节下标])
randomTime()



let 目标类型文件 = textContains("pdf").findOnce() || textContains("ppt").findOnce() || textContains("docx").findOnce() || textContains("doc").findOnce() || textContains("DOC").findOnce()
if (目标类型文件 != null) {
console.log("发现目标:" + 目标类型文件.text());
toast("发现目标,点击")
randomTime()


console.log("开始点击");
click_pro(目标类型文件)
randomTime()

if (text("立即打开").findOnce()) {
toast("需要打开,直接退出")
back()
randomTime()

randomTime()
back()
randomTime()

} else {
let timer = 8
while (timer != 0) {
randomTime(3000)
sml_move(400, 1800, 800, 230, 1000);
timer -= 1
console.log("还要滑动:" + timer + "次");
toast("还要滑动:" + timer + "次")
}
back()
randomTime()

randomTime()
back()
randomTime()
}



} else {
console.log("没有发现目标文件");
toast("没有发现目标文件")


randomTime()
back()
randomTime()


}

}



})

var thread = threads.start(() => {

// sleep(60 * 1000)

})




/* while (1) {
sleep(1000)
let 当前包名 = currentPackage()

if (当前包名 != "com.chaoxing.mobile") {
console.log("当前不是学习通的包名,结束所有脚本");
toast("当前不是学习通的包名,结束所有脚本")

console.log("END");
threads.shutDownAll()
break

}

} */




function click_pro(控件) {
click(控件.parent().bounds().centerX(), 控件.parent().bounds().centerY())
}



function randomTime(t) {
if (!t) {
t = 2000
}
var float = Math.random() * 0.4 * t;
var sleep_time = float + t
sleep(sleep_time)
}







function Ftime(time) {
if (time) {
return new java.text.SimpleDateFormat("MM-dd-hh-mm-ss").format(new Date(time));
} else {
return new java.text.SimpleDateFormat("yyyy-MM-dd--hh时-mm分-ss秒").format(new Date());
}
}






function bezier_curves(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;
}

//仿真随机带曲线滑动
//qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,过程耗时单位毫秒
function sml_move(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 + ")");

}
// log(point[3].x)

for (let i = 0; i < 1; i += 0.08) {
xxyy = [parseInt(bezier_curves(point, i).x), parseInt(bezier_curves(point, i).y)]

xxy.push(xxyy);

}

// log(xxy);
gesture.apply(null, xxy);
}