/**
|
亚瑟输入法
|
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);
|
}
|
}
|
}
|