hk
19 hours ago 90d0efabfd67c9bde72485a77b224ffb09936d28
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
/**
 亚瑟输入法
 com.arthur.input
 亚瑟精简版
 com.arthur.lite
 **/
 
let launch = require("slib/launch"), actions = require("slib/actions"), dynamicData = require("slib/dynamicData"),
    request = require("slib/request"), swiper = require("slib/swiper");
 
let scriptVersion = "2025.1.9"
logd("《雅诗rpa》启动成功,版本:" + scriptVersion);
 
let storage = storages.create("storage"); //创建存储对象
storage.clear(); //清空存储
 
let platform = 7; //运行平台: 1抖音  2小红书  3快手 4百度 5QQ浏览器 6输入法 7雅诗机器人
let taskInfo = request.getTask(); //获取任务信息
if (taskInfo.tenantId) storage.putInt("tenantId", taskInfo.tenantId); //存储租户id
 
let taskId = launch.taskThread(random(30, 40)); //开启任务时间线程 30分钟
launch.launchDevice(taskId); //唤醒设备
 
 
let hasLaunchApp = launch.launchApp(7, 30000, 3); //打开雅诗机器人
if (hasLaunchApp) {
    launch.alertListener(1, taskId); //处理弹窗
    //启动arthur任务
    startArthur();
}
// let t =setInterval(function (){
//     logd('我是定时执行脚本')
//     //startArthur
// },1000*2)
//需要清空
/**
 * description 启动arthur任务
 * @
 */
function startArthur() {
    let startNum = 0;
    while (!thread.isCancelled(taskId)) {
        if (startNum < 5) {
            try {
                //是否为商家用户
                let btnStart;
                if (platform === 7) btnStart = text("任务").getOneNodeInfo(5000);
                // logd(JSON.stringify(btnStart))
                if (btnStart) {
                    if (btnStart && btnStart.parent().click()) {
                        let startBtn = text('启动').getOneNodeInfo(1000);
                        let suoBox = text('锁').getOneNodeInfo(1000);
                        sleep(1000);
                        if (suoBox.checked) { //
                            logd('已锁状态~');
                            // logd('已锁并运行 ~~~~',logd(JSON.stringify(suoBox)) ,suoBox.click())
                            sleep(1000);
                            if (suoBox&&suoBox.click()) {
                                logd('解锁成功~');
                                // 解锁
                                if (startBtn&&startBtn.click()) {
                                    //启动
                                    startNum++;
                                    logd('启动成功了 ')
                                }else {
                                    logd('没有锁成功启动按钮');
                                }
                            }
                        } else {
                            logd('未锁状态~');
                            if (startBtn&&startBtn.click()) {
                                startNum++;
                                logd('启动成功了 ');
                            } else {
                                logd('没有锁成功启动按钮');
                            }
                        }
                    } else {
                        logd('没有定位到任务');
                    }
                }
            } catch (e) {
                if (!thread.isCancelled(taskId)) {
                    logd('未找到有效:' + e);
                }
            }
        } else {
            logd('执行startArthur,startNum:' + startNum);
        }
    }
}