-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path[企业版]外部控制能力.js
72 lines (57 loc) · 1.63 KB
/
[企业版]外部控制能力.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
/**
* 小瓶RPA演示demo,具体api请查看*流程开发文档*
* 官网:https://rpa.pbottle.com/
* 流程开发文档:https://gitee.com/pbottle/pbottle-rpa/wikis/pages
*/
const pbottleRPA = require('./pbottleRPA')
console.log("=== 测试 ===");
console.log(Date());
//监测是否开通企业版
let bufferRS = pbottleRPA.bufferSet('pbottle');
if (bufferRS == '个人版不可用') {
pbottleRPA.showMsg('个人版不可用','请先开通企业版')
pbottleRPA.tts('个人版不可用,请先开通企业版')
pbottleRPA.exit('⚠ 个人版不可用,请先开通企业版')
}
/**
* buffers
*/
pbottleRPA.sleep(200)
for (let index = 0; index < 10; index++) {
let content = "我是 +=<& buffer"+index
pbottleRPA.bufferSet(content,index)
}
pbottleRPA.sleep(200)
for (let index = 0; index < 10; index++) {
console.log('buffer'+ index + ' 内容:', pbottleRPA.bufferGet(index));
}
let other = '其他内容'
let myJson = {
name:'小瓶RPA',
webSite:'https://rpa.pbottle.com/',
version:2,
app:['pc','web','mobile'],
other,
}
pbottleRPA.bufferSet(myJson) //默认buffer0
console.log('获取buffer: ',pbottleRPA.bufferGet());
/**
* 启停
*/
let path=__filename;
console.log(path);
let url = 'http://127.0.0.1:49888/?action=pbottleRPA_run&path='+encodeURIComponent(path)
console.log(url);
fetch(url).then((rs)=>{
console.log(rs.status);
return rs.text()
}).then((txt)=>{
console.log('启动结果:',txt);
}).catch((error)=>{
console.log(error);
})
setTimeout(()=>{
//外部停止
let urlStop = 'http://127.0.0.1:49888/?action=pbottleRPA_stop'
fetch(urlStop)
},3000)