commit | author | age
|
90d0ef
|
1 |
/** |
H |
2 |
亚瑟输入法 |
|
3 |
com.arthur.input |
|
4 |
亚瑟精简版 |
|
5 |
com.arthur.lite |
|
6 |
**/ |
|
7 |
|
|
8 |
let launch = require("slib/launch"), actions = require("slib/actions"), dynamicData = require("slib/dynamicData"), |
|
9 |
request = require("slib/request"), swiper = require("slib/swiper"); |
|
10 |
|
|
11 |
let scriptVersion = "2025.1.9" |
|
12 |
logd("《雅诗rpa》启动成功,版本:" + scriptVersion); |
|
13 |
|
|
14 |
let storage = storages.create("storage"); //创建存储对象 |
|
15 |
storage.clear(); //清空存储 |
|
16 |
|
|
17 |
let platform = 7; //运行平台: 1抖音 2小红书 3快手 4百度 5QQ浏览器 6输入法 7雅诗机器人 |
|
18 |
let taskInfo = request.getTask(); //获取任务信息 |
|
19 |
if (taskInfo.tenantId) storage.putInt("tenantId", taskInfo.tenantId); //存储租户id |
|
20 |
|
7b91e6
|
21 |
let taskId = launch.taskThread(random(60, 70)); //开启任务时间线程 30分钟 |
90d0ef
|
22 |
launch.launchDevice(taskId); //唤醒设备 |
H |
23 |
|
|
24 |
|
|
25 |
let hasLaunchApp = launch.launchApp(7, 30000, 3); //打开雅诗机器人 |
|
26 |
if (hasLaunchApp) { |
|
27 |
launch.alertListener(1, taskId); //处理弹窗 |
|
28 |
//启动arthur任务 |
|
29 |
startArthur(); |
|
30 |
} |
|
31 |
// let t =setInterval(function (){ |
|
32 |
// logd('我是定时执行脚本') |
|
33 |
// //startArthur |
|
34 |
// },1000*2) |
|
35 |
//需要清空 |
|
36 |
/** |
|
37 |
* description 启动arthur任务 |
|
38 |
* @ |
|
39 |
*/ |
|
40 |
function startArthur() { |
|
41 |
let startNum = 0; |
|
42 |
while (!thread.isCancelled(taskId)) { |
7b91e6
|
43 |
if (startNum < 1) { |
90d0ef
|
44 |
try { |
H |
45 |
//是否为商家用户 |
|
46 |
let btnStart; |
|
47 |
if (platform === 7) btnStart = text("任务").getOneNodeInfo(5000); |
|
48 |
// logd(JSON.stringify(btnStart)) |
|
49 |
if (btnStart) { |
|
50 |
if (btnStart && btnStart.parent().click()) { |
|
51 |
let startBtn = text('启动').getOneNodeInfo(1000); |
|
52 |
let suoBox = text('锁').getOneNodeInfo(1000); |
|
53 |
sleep(1000); |
|
54 |
if (suoBox.checked) { // |
|
55 |
logd('已锁状态~'); |
|
56 |
// logd('已锁并运行 ~~~~',logd(JSON.stringify(suoBox)) ,suoBox.click()) |
|
57 |
sleep(1000); |
|
58 |
if (suoBox&&suoBox.click()) { |
|
59 |
logd('解锁成功~'); |
|
60 |
// 解锁 |
|
61 |
if (startBtn&&startBtn.click()) { |
|
62 |
//启动 |
|
63 |
startNum++; |
|
64 |
logd('启动成功了 ') |
|
65 |
}else { |
|
66 |
logd('没有锁成功启动按钮'); |
|
67 |
} |
|
68 |
} |
|
69 |
} else { |
|
70 |
logd('未锁状态~'); |
|
71 |
if (startBtn&&startBtn.click()) { |
|
72 |
startNum++; |
|
73 |
logd('启动成功了 '); |
|
74 |
} else { |
|
75 |
logd('没有锁成功启动按钮'); |
|
76 |
} |
|
77 |
} |
|
78 |
} else { |
|
79 |
logd('没有定位到任务'); |
|
80 |
} |
|
81 |
} |
|
82 |
} catch (e) { |
|
83 |
if (!thread.isCancelled(taskId)) { |
|
84 |
logd('未找到有效:' + e); |
|
85 |
} |
|
86 |
} |
|
87 |
} else { |
|
88 |
logd('执行startArthur,startNum:' + startNum); |
|
89 |
} |
|
90 |
} |
|
91 |
} |
|
92 |
|