-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path鼠标基础操作演示.js
111 lines (78 loc) · 2.53 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
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
/**
* 小瓶RPA演示demo,具体api请查看*流程开发文档*
* 官网:https://rpa.pbottle.com/
* 流程开发文档:https://gitee.com/pbottle/pbottle-rpa/wikis/pages
*/
const pbottleRPA = require('./pbottleRPA')
console.log("=== 鼠标基础演示测试 ===");
console.log(Date());
pbottleRPA.setDefaultDelay(0); //手动管理操作延时
pbottleRPA.tts('开始运行小瓶RPA鼠标操作演示脚本。... 快捷键 :Ctrl+shift+Q 可手动退出')
//延迟5秒
pbottleRPA.wait(12)
let resolution = pbottleRPA.getResolution()
console.log('当前电脑屏幕分辨率',resolution)
pbottleRPA.keyTap('windows+d')
pbottleRPA.tts(`当前电脑屏幕分辨率: ${resolution.w} 乘以 ${resolution.h}`)
pbottleRPA.wait(6)
pbottleRPA.tts(`移动指针到屏幕中点`)
pbottleRPA.log(`移动指针到屏幕中点`)
pbottleRPA.moveMouse(resolution.w/2,resolution.h/2)
pbottleRPA.wait(3)
pbottleRPA.tts(`长按左键`)
pbottleRPA.log(`长按左键`)
pbottleRPA.mouseClick('left',1500);
pbottleRPA.wait(2)
pbottleRPA.tts(`鼠标双击`)
pbottleRPA.log(`鼠标双击`)
pbottleRPA.moveMouse(38,38)
pbottleRPA.mouseDoubleClick()
pbottleRPA.wait(3)
pbottleRPA.tts('准备打开网页并滚动鼠标,5秒后开始')
pbottleRPA.wait(10)
//用浏览器打开网址
pbottleRPA.openURL('https://rpa.pbottle.com?from=demo')
pbottleRPA.wait(3)
pbottleRPA.keyTap('f11')
pbottleRPA.wait(1)
pbottleRPA.tts('滚动鼠标')
pbottleRPA.mouseWheel()
pbottleRPA.wait(4)
pbottleRPA.tts('反向滚动鼠标')
pbottleRPA.mouseWheel(360)
pbottleRPA.wait(4)
pbottleRPA.tts('右键页面')
pbottleRPA.log('右键页面')
pbottleRPA.moveMouse(200,250)
pbottleRPA.mouseClick('right')
pbottleRPA.wait(3)
pbottleRPA.moveMouse(150,250)
pbottleRPA.tts('左键单击')
pbottleRPA.log('左键单击')
pbottleRPA.mouseClick()
pbottleRPA.wait(3)
//测试鼠标拖拽
pbottleRPA.tts('拖拽或选区')
pbottleRPA.log('拖拽或选区')
pbottleRPA.wait(4)
pbottleRPA.moveMouse(resolution.w*0.7,resolution.h*0.5)
pbottleRPA.wait(1)
pbottleRPA.mouseLeftDragTo(resolution.w*0.3,resolution.h*0.2)
//
pbottleRPA.tts('缓慢拖拽')
pbottleRPA.log('缓慢拖拽')
pbottleRPA.wait(4)
pbottleRPA.mouseClick()
pbottleRPA.wait(1)
pbottleRPA.mouseKeyToggle('left','down')
pbottleRPA.moveMouse(resolution.w*0.7,resolution.h*0.5,3)
pbottleRPA.mouseKeyToggle('left','up')
pbottleRPA.wait(5)
pbottleRPA.mouseClick()
pbottleRPA.keyTap('f11')
pbottleRPA.tts('演示结束')
console.log("准备结束脚本");
pbottleRPA.wait(3)
//脚本强制退出
process.exit(1)
console.log("已经退出了,无效");