pp-robot-module 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +34 -0
  2. package/dist/MR/Ai.d.ts +8 -0
  3. package/dist/MR/Ai.js +24 -0
  4. package/dist/MR/Clipboard.d.ts +20 -0
  5. package/dist/MR/Clipboard.js +60 -0
  6. package/dist/MR/Csv.d.ts +20 -0
  7. package/dist/MR/Csv.js +56 -0
  8. package/dist/MR/Date.d.ts +60 -0
  9. package/dist/MR/Date.js +94 -0
  10. package/dist/MR/DbClient.d.ts +97 -0
  11. package/dist/MR/DbClient.js +269 -0
  12. package/dist/MR/Dialog.d.ts +0 -0
  13. package/dist/MR/Dialog.js +40 -0
  14. package/dist/MR/Excel.d.ts +110 -0
  15. package/dist/MR/Excel.js +316 -0
  16. package/dist/MR/File.d.ts +162 -0
  17. package/dist/MR/File.js +399 -0
  18. package/dist/MR/Hash.d.ts +12 -0
  19. package/dist/MR/Hash.js +21 -0
  20. package/dist/MR/Html.d.ts +38 -0
  21. package/dist/MR/Html.js +163 -0
  22. package/dist/MR/Http.d.ts +33 -0
  23. package/dist/MR/Http.js +121 -0
  24. package/dist/MR/Imap.d.ts +15 -0
  25. package/dist/MR/Imap.js +52 -0
  26. package/dist/MR/Ini.d.ts +31 -0
  27. package/dist/MR/Ini.js +55 -0
  28. package/dist/MR/Keyboard.d.ts +59 -0
  29. package/dist/MR/Keyboard.js +515 -0
  30. package/dist/MR/Log.d.ts +7 -0
  31. package/dist/MR/Log.js +52 -0
  32. package/dist/MR/Mouse.d.ts +51 -0
  33. package/dist/MR/Mouse.js +152 -0
  34. package/dist/MR/Net.d.ts +17 -0
  35. package/dist/MR/Net.js +74 -0
  36. package/dist/MR/Pdf.d.ts +113 -0
  37. package/dist/MR/Pdf.js +197 -0
  38. package/dist/MR/Process.d.ts +46 -0
  39. package/dist/MR/Process.js +106 -0
  40. package/dist/MR/QRcode.d.ts +13 -0
  41. package/dist/MR/QRcode.js +37 -0
  42. package/dist/MR/RedisClient.d.ts +40 -0
  43. package/dist/MR/RedisClient.js +183 -0
  44. package/dist/MR/Regex.d.ts +16 -0
  45. package/dist/MR/Regex.js +20 -0
  46. package/dist/MR/Robot.d.ts +19 -0
  47. package/dist/MR/Robot.js +31 -0
  48. package/dist/MR/Screen.d.ts +20 -0
  49. package/dist/MR/Screen.js +79 -0
  50. package/dist/MR/Smtp.d.ts +21 -0
  51. package/dist/MR/Smtp.js +83 -0
  52. package/dist/MR/String.d.ts +104 -0
  53. package/dist/MR/String.js +166 -0
  54. package/dist/MR/System.d.ts +31 -0
  55. package/dist/MR/System.js +201 -0
  56. package/dist/MR/Validator.d.ts +30 -0
  57. package/dist/MR/Validator.js +104 -0
  58. package/dist/MR/WebBrowser.d.ts +210 -0
  59. package/dist/MR/WebBrowser.js +484 -0
  60. package/dist/MR/WebBrowser2.d.ts +0 -0
  61. package/dist/MR/WebBrowser2.js +504 -0
  62. package/dist/MR/WebElement.d.ts +123 -0
  63. package/dist/MR/WebElement.js +172 -0
  64. package/dist/MR/WebKeyboard.d.ts +21 -0
  65. package/dist/MR/WebKeyboard.js +48 -0
  66. package/dist/MR/WebMouse.d.ts +46 -0
  67. package/dist/MR/WebMouse.js +79 -0
  68. package/dist/MR/Window.d.ts +8 -0
  69. package/dist/MR/Window.js +34 -0
  70. package/dist/MR/Word.d.ts +56 -0
  71. package/dist/MR/Word.js +220 -0
  72. package/dist/MR/Zip.d.ts +25 -0
  73. package/dist/MR/Zip.js +89 -0
  74. package/dist/bin/inputting-method.exe +0 -0
  75. package/dist/bin/keyboard-password.exe +0 -0
  76. package/dist/bin/lock-window.exe +0 -0
  77. package/dist/bin/printer-pdf.exe +0 -0
  78. package/dist/dotenv.d.ts +0 -0
  79. package/dist/dotenv.js +2 -0
  80. package/dist/index.d.ts +54 -0
  81. package/dist/index.js +63 -0
  82. package/dist/util.d.ts +17 -0
  83. package/dist/util.js +41 -0
  84. package/package.json +120 -0
@@ -0,0 +1,515 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MR = void 0;
13
+ const { spawnSync } = require('child_process');
14
+ const path = require('path');
15
+ const fs = require('fs');
16
+ const os = require('os');
17
+ const fsExt = require('fs-extra');
18
+ const KEYBOARD_PASSWORD_EXE = 'keyboard-password.exe';
19
+ const FOLDER_PATH = path.join(os.homedir(), '.makwing');
20
+ const KEYBOARD_PASSWORD_EXE_PATH = path.join(FOLDER_PATH, KEYBOARD_PASSWORD_EXE);
21
+ const nut_js_1 = require("@nut-tree/nut-js");
22
+ const Log_1 = require("./Log");
23
+ var MR;
24
+ (function (MR) {
25
+ class Keyboard {
26
+ constructor() { }
27
+ static get() {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ Log_1.default.debug("Keyboard.get");
30
+ return nut_js_1.keyboard;
31
+ });
32
+ }
33
+ static isFileExist(filePath) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ try {
36
+ yield fs.promises.access(filePath, fs.constants.F_OK);
37
+ return true;
38
+ }
39
+ catch (err) {
40
+ return false;
41
+ }
42
+ });
43
+ }
44
+ static copyFile(srcPath, destPath) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ try {
47
+ yield fs.promises.copyFile(srcPath, destPath);
48
+ Log_1.default.debug(`Keyboard文件复制成功:${srcPath} -> ${destPath}`);
49
+ }
50
+ catch (err) {
51
+ Log_1.default.error(`Keyboard复制文件失败: ${err.message}`);
52
+ }
53
+ });
54
+ }
55
+ static password(params) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ Log_1.default.debug("Keyboard.password", params);
58
+ let isDebug = params._debug;
59
+ let oriExe = path.join(__dirname, "../bin/keyboard-password.exe");
60
+ if (!isDebug) { //复制到home中执行
61
+ yield fsExt.ensureDir(FOLDER_PATH);
62
+ let newExe = path.join(FOLDER_PATH, KEYBOARD_PASSWORD_EXE);
63
+ if (!(yield this.isFileExist(newExe))) {
64
+ yield this.copyFile(oriExe, KEYBOARD_PASSWORD_EXE_PATH);
65
+ }
66
+ oriExe = newExe;
67
+ }
68
+ const result = spawnSync(oriExe, [params._msg]);
69
+ if (result.status === 0) {
70
+ Log_1.default.debug(`Keyboard.password: stdout : ${result.stdout}`);
71
+ }
72
+ else {
73
+ Log_1.default.debug(`Keyboard.password: stderr : ${result.stderr}`);
74
+ }
75
+ });
76
+ }
77
+ static str(params) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ Log_1.default.debug("Keyboard.str", params);
80
+ return yield nut_js_1.keyboard.type(params._msg);
81
+ });
82
+ }
83
+ static convert(_key) {
84
+ if (_key.toLowerCase() === 'ctrl' || _key.toLowerCase() === 'control') {
85
+ return 'LeftControl';
86
+ }
87
+ if (_key.toLowerCase() === 'shift') {
88
+ return 'LeftShift';
89
+ }
90
+ if (_key.toLowerCase() === 'alt') {
91
+ return 'LeftAlt';
92
+ }
93
+ if (_key.toLowerCase() === 'esc') {
94
+ return 'Escape';
95
+ }
96
+ if (_key.toLowerCase() === 'caps') {
97
+ return 'CapsLock';
98
+ }
99
+ if (_key.toLowerCase() === 'win' || _key.toLowerCase() === 'window') {
100
+ return 'LeftWin';
101
+ }
102
+ if (_key.toLowerCase().includes('arrow')) {
103
+ return _key.toLowerCase().replace('arrow', '');
104
+ }
105
+ if (Number.isFinite(_key)) {
106
+ return 'Num' + _key;
107
+ }
108
+ if (_key.length == 1 && _key.charCodeAt(0) >= 97 && _key.charCodeAt(0) <= 122) {
109
+ return _key.toUpperCase();
110
+ }
111
+ return _key;
112
+ }
113
+ static press(params) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ Log_1.default.debug("Keyboard.press", params);
116
+ let newKey = this.convert(params._key);
117
+ let keyEnum = this.getKeyEnum(newKey);
118
+ if (keyEnum) {
119
+ yield nut_js_1.keyboard.pressKey(keyEnum);
120
+ yield nut_js_1.keyboard.releaseKey(keyEnum);
121
+ }
122
+ });
123
+ }
124
+ static hotkey(params) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ Log_1.default.debug("Keyboard.hotkey", params);
127
+ let keyEnums = [];
128
+ for (let index = 0; index < params._keys.length; index++) {
129
+ const _key = params._keys[index];
130
+ let newKey = this.convert(_key);
131
+ keyEnums.push(this.getKeyEnum(newKey));
132
+ }
133
+ yield nut_js_1.keyboard.pressKey(...keyEnums);
134
+ yield nut_js_1.keyboard.releaseKey(...keyEnums);
135
+ });
136
+ }
137
+ static Win_D() {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ Log_1.default.debug("Keyboard.Win+D");
140
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.D, nut_js_1.Key.LeftWin);
141
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.D, nut_js_1.Key.LeftWin);
142
+ });
143
+ }
144
+ static Alt_F4() {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ Log_1.default.debug("Keyboard.Alt+F4");
147
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftAlt, nut_js_1.Key.F4);
148
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftAlt, nut_js_1.Key.F4);
149
+ });
150
+ }
151
+ static Ctrl_C() {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ Log_1.default.debug("Keyboard.Ctrl+C");
154
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftControl, nut_js_1.Key.C);
155
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftControl, nut_js_1.Key.C);
156
+ });
157
+ }
158
+ static Ctrl_V() {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ Log_1.default.debug("Keyboard.Ctrl+V");
161
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftControl, nut_js_1.Key.V);
162
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftControl, nut_js_1.Key.V);
163
+ });
164
+ }
165
+ static Ctrl_Shift() {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ Log_1.default.debug("Keyboard.Ctrl+Shift");
168
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftControl, nut_js_1.Key.LeftShift);
169
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftControl, nut_js_1.Key.LeftShift);
170
+ });
171
+ }
172
+ static Home() {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ Log_1.default.debug("Keyboard.Home");
175
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Home);
176
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Home);
177
+ });
178
+ }
179
+ static End() {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ Log_1.default.debug("Keyboard.End");
182
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.End);
183
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.End);
184
+ });
185
+ }
186
+ static Down() {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ Log_1.default.debug("Keyboard.Down");
189
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Down);
190
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Down);
191
+ });
192
+ }
193
+ static Left() {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ Log_1.default.debug("Keyboard.Left");
196
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Left);
197
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Left);
198
+ });
199
+ }
200
+ static Up() {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ Log_1.default.debug("Keyboard.Up");
203
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Up);
204
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Up);
205
+ });
206
+ }
207
+ static Right() {
208
+ return __awaiter(this, void 0, void 0, function* () {
209
+ Log_1.default.debug("Keyboard.Right");
210
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Right);
211
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Right);
212
+ });
213
+ }
214
+ static CapsLock() {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ Log_1.default.debug("Keyboard.CapsLock");
217
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.CapsLock);
218
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.CapsLock);
219
+ });
220
+ }
221
+ static Shift() {
222
+ return __awaiter(this, void 0, void 0, function* () {
223
+ Log_1.default.debug("Keyboard.Shift");
224
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftShift);
225
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftShift);
226
+ });
227
+ }
228
+ static Ctrl() {
229
+ return __awaiter(this, void 0, void 0, function* () {
230
+ Log_1.default.debug("Keyboard.Ctrl");
231
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftControl);
232
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftControl);
233
+ });
234
+ }
235
+ static Alt() {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ Log_1.default.debug("Keyboard.Alt");
238
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.LeftAlt);
239
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.LeftAlt);
240
+ });
241
+ }
242
+ static Tab() {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ Log_1.default.debug("Keyboard.Tab");
245
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Tab);
246
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Tab);
247
+ });
248
+ }
249
+ static Space() {
250
+ return __awaiter(this, void 0, void 0, function* () {
251
+ Log_1.default.debug("Keyboard.Space");
252
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Space);
253
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Space);
254
+ });
255
+ }
256
+ static Backspace() {
257
+ return __awaiter(this, void 0, void 0, function* () {
258
+ Log_1.default.debug("Keyboard.Backspace");
259
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Backspace);
260
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Backspace);
261
+ });
262
+ }
263
+ static Delete() {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ Log_1.default.debug("Keyboard.Delete");
266
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Delete);
267
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Delete);
268
+ });
269
+ }
270
+ static Enter() {
271
+ return __awaiter(this, void 0, void 0, function* () {
272
+ Log_1.default.debug("Keyboard.Enter");
273
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Enter);
274
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Enter);
275
+ });
276
+ }
277
+ static Escape() {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ Log_1.default.debug("Keyboard.Escape");
280
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.Escape);
281
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.Escape);
282
+ });
283
+ }
284
+ static F1() {
285
+ return __awaiter(this, void 0, void 0, function* () {
286
+ Log_1.default.debug("Keyboard.F1");
287
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F1);
288
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F1);
289
+ });
290
+ }
291
+ static F2() {
292
+ return __awaiter(this, void 0, void 0, function* () {
293
+ Log_1.default.debug("Keyboard.F2");
294
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F2);
295
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F2);
296
+ });
297
+ }
298
+ static F3() {
299
+ return __awaiter(this, void 0, void 0, function* () {
300
+ Log_1.default.debug("Keyboard.F3");
301
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F3);
302
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F3);
303
+ });
304
+ }
305
+ static F4() {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ Log_1.default.debug("Keyboard.F4");
308
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F4);
309
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F4);
310
+ });
311
+ }
312
+ static F5() {
313
+ return __awaiter(this, void 0, void 0, function* () {
314
+ Log_1.default.debug("Keyboard.F5");
315
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F5);
316
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F5);
317
+ });
318
+ }
319
+ static F6() {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
+ Log_1.default.debug("Keyboard.F6");
322
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F6);
323
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F6);
324
+ });
325
+ }
326
+ static F7() {
327
+ return __awaiter(this, void 0, void 0, function* () {
328
+ Log_1.default.debug("Keyboard.F7");
329
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F7);
330
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F7);
331
+ });
332
+ }
333
+ static F8() {
334
+ return __awaiter(this, void 0, void 0, function* () {
335
+ Log_1.default.debug("Keyboard.F8");
336
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F8);
337
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F8);
338
+ });
339
+ }
340
+ static F9() {
341
+ return __awaiter(this, void 0, void 0, function* () {
342
+ Log_1.default.debug("Keyboard.F9");
343
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F9);
344
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F9);
345
+ });
346
+ }
347
+ static F10() {
348
+ return __awaiter(this, void 0, void 0, function* () {
349
+ Log_1.default.debug("Keyboard.F10");
350
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F10);
351
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F10);
352
+ });
353
+ }
354
+ static F11() {
355
+ return __awaiter(this, void 0, void 0, function* () {
356
+ Log_1.default.debug("Keyboard.F11");
357
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F11);
358
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F11);
359
+ });
360
+ }
361
+ static F12() {
362
+ return __awaiter(this, void 0, void 0, function* () {
363
+ Log_1.default.debug("Keyboard.F12");
364
+ yield nut_js_1.keyboard.pressKey(nut_js_1.Key.F12);
365
+ yield nut_js_1.keyboard.releaseKey(nut_js_1.Key.F12);
366
+ });
367
+ }
368
+ static getKeyEnum(char) {
369
+ Log_1.default.debug("Keyboard.getKeyEnum", char);
370
+ for (let key in Keyboard.InnerKeyEnums) {
371
+ if (key === char) {
372
+ return Keyboard.InnerKeyEnums[key];
373
+ }
374
+ }
375
+ }
376
+ }
377
+ //update by 2023.5.24 key版本为3.1.1
378
+ Keyboard.InnerKeyEnums = {
379
+ "Space": nut_js_1.Key.Space,
380
+ "Escape": nut_js_1.Key.Escape,
381
+ "Tab": nut_js_1.Key.Tab,
382
+ "LeftAlt": nut_js_1.Key.LeftAlt,
383
+ "LeftControl": nut_js_1.Key.LeftControl,
384
+ "RightAlt": nut_js_1.Key.RightAlt,
385
+ "RightControl": nut_js_1.Key.RightControl,
386
+ "LeftShift": nut_js_1.Key.LeftShift,
387
+ "LeftSuper": nut_js_1.Key.LeftSuper,
388
+ "RightShift": nut_js_1.Key.RightShift,
389
+ "RightSuper": nut_js_1.Key.RightSuper,
390
+ "F1": nut_js_1.Key.F1,
391
+ "F2": nut_js_1.Key.F2,
392
+ "F3": nut_js_1.Key.F3,
393
+ "F4": nut_js_1.Key.F4,
394
+ "F5": nut_js_1.Key.F5,
395
+ "F6": nut_js_1.Key.F6,
396
+ "F7": nut_js_1.Key.F7,
397
+ "F8": nut_js_1.Key.F8,
398
+ "F9": nut_js_1.Key.F9,
399
+ "F10": nut_js_1.Key.F10,
400
+ "F11": nut_js_1.Key.F11,
401
+ "F12": nut_js_1.Key.F12,
402
+ "F13": nut_js_1.Key.F13,
403
+ "F14": nut_js_1.Key.F14,
404
+ "F15": nut_js_1.Key.F15,
405
+ "F16": nut_js_1.Key.F16,
406
+ "F17": nut_js_1.Key.F17,
407
+ "F18": nut_js_1.Key.F18,
408
+ "F19": nut_js_1.Key.F19,
409
+ "F20": nut_js_1.Key.F20,
410
+ "F21": nut_js_1.Key.F21,
411
+ "F22": nut_js_1.Key.F22,
412
+ "F23": nut_js_1.Key.F23,
413
+ "F24": nut_js_1.Key.F24,
414
+ "Num0": nut_js_1.Key.Num0,
415
+ "Num1": nut_js_1.Key.Num1,
416
+ "Num2": nut_js_1.Key.Num2,
417
+ "Num3": nut_js_1.Key.Num3,
418
+ "Num4": nut_js_1.Key.Num4,
419
+ "Num5": nut_js_1.Key.Num5,
420
+ "Num6": nut_js_1.Key.Num6,
421
+ "Num7": nut_js_1.Key.Num7,
422
+ "Num8": nut_js_1.Key.Num8,
423
+ "Num9": nut_js_1.Key.Num9,
424
+ "A": nut_js_1.Key.A,
425
+ "B": nut_js_1.Key.B,
426
+ "C": nut_js_1.Key.C,
427
+ "D": nut_js_1.Key.D,
428
+ "E": nut_js_1.Key.E,
429
+ "F": nut_js_1.Key.F,
430
+ "G": nut_js_1.Key.G,
431
+ "H": nut_js_1.Key.H,
432
+ "I": nut_js_1.Key.I,
433
+ "J": nut_js_1.Key.J,
434
+ "K": nut_js_1.Key.K,
435
+ "L": nut_js_1.Key.L,
436
+ "M": nut_js_1.Key.M,
437
+ "N": nut_js_1.Key.N,
438
+ "O": nut_js_1.Key.O,
439
+ "P": nut_js_1.Key.P,
440
+ "Q": nut_js_1.Key.Q,
441
+ "R": nut_js_1.Key.R,
442
+ "S": nut_js_1.Key.S,
443
+ "T": nut_js_1.Key.T,
444
+ "U": nut_js_1.Key.U,
445
+ "V": nut_js_1.Key.V,
446
+ "W": nut_js_1.Key.W,
447
+ "X": nut_js_1.Key.X,
448
+ "Y": nut_js_1.Key.Y,
449
+ "Z": nut_js_1.Key.Z,
450
+ "Grave": nut_js_1.Key.Grave,
451
+ "Minus": nut_js_1.Key.Minus,
452
+ "Equal": nut_js_1.Key.Equal,
453
+ "Backspace": nut_js_1.Key.Backspace,
454
+ "LeftBracket": nut_js_1.Key.LeftBracket,
455
+ "RightBracket": nut_js_1.Key.RightBracket,
456
+ "Backslash": nut_js_1.Key.Backslash,
457
+ "Semicolon": nut_js_1.Key.Semicolon,
458
+ "Quote": nut_js_1.Key.Quote,
459
+ "Return": nut_js_1.Key.Return,
460
+ "Comma": nut_js_1.Key.Comma,
461
+ "Period": nut_js_1.Key.Period,
462
+ "Slash": nut_js_1.Key.Slash,
463
+ "Left": nut_js_1.Key.Left,
464
+ "Up": nut_js_1.Key.Up,
465
+ "Right": nut_js_1.Key.Right,
466
+ "Down": nut_js_1.Key.Down,
467
+ "Print": nut_js_1.Key.Print,
468
+ "Pause": nut_js_1.Key.Pause,
469
+ "Insert": nut_js_1.Key.Insert,
470
+ "Delete": nut_js_1.Key.Delete,
471
+ "Home": nut_js_1.Key.Home,
472
+ "End": nut_js_1.Key.End,
473
+ "PageUp": nut_js_1.Key.PageUp,
474
+ "PageDown": nut_js_1.Key.PageDown,
475
+ "Add": nut_js_1.Key.Add,
476
+ "Subtract": nut_js_1.Key.Subtract,
477
+ "Multiply": nut_js_1.Key.Multiply,
478
+ "Divide": nut_js_1.Key.Divide,
479
+ "Decimal": nut_js_1.Key.Decimal,
480
+ "Enter": nut_js_1.Key.Enter,
481
+ "NumPad0": nut_js_1.Key.NumPad0,
482
+ "NumPad1": nut_js_1.Key.NumPad1,
483
+ "NumPad2": nut_js_1.Key.NumPad2,
484
+ "NumPad3": nut_js_1.Key.NumPad3,
485
+ "NumPad4": nut_js_1.Key.NumPad4,
486
+ "NumPad5": nut_js_1.Key.NumPad5,
487
+ "NumPad6": nut_js_1.Key.NumPad6,
488
+ "NumPad7": nut_js_1.Key.NumPad7,
489
+ "NumPad8": nut_js_1.Key.NumPad8,
490
+ "NumPad9": nut_js_1.Key.NumPad9,
491
+ "CapsLock": nut_js_1.Key.CapsLock,
492
+ "ScrollLock": nut_js_1.Key.ScrollLock,
493
+ "NumLock": nut_js_1.Key.NumLock,
494
+ "AudioMute": nut_js_1.Key.AudioMute,
495
+ "AudioVolDown": nut_js_1.Key.AudioVolDown,
496
+ "AudioVolUp": nut_js_1.Key.AudioVolUp,
497
+ "AudioPlay": nut_js_1.Key.AudioPlay,
498
+ "AudioStop": nut_js_1.Key.AudioStop,
499
+ "AudioPause": nut_js_1.Key.AudioPause,
500
+ "AudioPrev": nut_js_1.Key.AudioPrev,
501
+ "AudioNext": nut_js_1.Key.AudioNext,
502
+ "AudioRewind": nut_js_1.Key.AudioRewind,
503
+ "AudioForward": nut_js_1.Key.AudioForward,
504
+ "AudioRepeat": nut_js_1.Key.AudioRepeat,
505
+ "AudioRandom": nut_js_1.Key.AudioRandom,
506
+ "LeftWin": nut_js_1.Key.LeftWin,
507
+ "RightWin": nut_js_1.Key.RightWin,
508
+ "LeftCmd": nut_js_1.Key.LeftCmd,
509
+ "RightCmd": nut_js_1.Key.RightCmd,
510
+ "Menu": nut_js_1.Key.Menu,
511
+ "Fn": nut_js_1.Key.Fn,
512
+ };
513
+ MR.Keyboard = Keyboard;
514
+ })(MR = exports.MR || (exports.MR = {}));
515
+ exports.default = MR.Keyboard;
@@ -0,0 +1,7 @@
1
+ export declare namespace MR {
2
+ const Logger: import("log4js").Logger;
3
+ const ErrorLogger: import("log4js").Logger;
4
+ const webLogger: import("log4js").Logger;
5
+ }
6
+ declare const _default: import("log4js").Logger;
7
+ export default _default;
package/dist/MR/Log.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MR = void 0;
4
+ const log4js_1 = require("log4js");
5
+ let LOG_PATH = process.env.LOG_PATH || './logs';
6
+ (0, log4js_1.configure)({
7
+ appenders: {
8
+ stdout: {
9
+ type: 'console',
10
+ layout: {
11
+ type: 'pattern',
12
+ pattern: 'time:%d{yyyy-MM-dd hh:mm:ss,SSS}%nlevel:[%p]%nmessage:%m%n------------------------------------'
13
+ }
14
+ },
15
+ info: {
16
+ type: 'dateFile',
17
+ filename: `${LOG_PATH}/info.log`,
18
+ layout: {
19
+ type: 'pattern',
20
+ pattern: 'time:%d{yyyy-MM-dd hh:mm:ss,SSS}%nlevel:[%p]%nmessage:%m%n------------------------------------'
21
+ }
22
+ },
23
+ error: {
24
+ type: 'dateFile',
25
+ filename: `${LOG_PATH}/error.log`,
26
+ layout: {
27
+ type: 'pattern',
28
+ pattern: 'time:%d{yyyy-MM-dd hh:mm:ss,SSS}%nlevel:[%p]%nmessage:%m%n------------------------------------'
29
+ }
30
+ },
31
+ webinfo: {
32
+ type: 'dateFile',
33
+ filename: `${LOG_PATH}/webinfo.log`,
34
+ layout: {
35
+ type: 'pattern',
36
+ pattern: 'time:%d{yyyy-MM-dd hh:mm:ss,SSS}%nlevel:[%p]%nmessage:%m%n------------------------------------'
37
+ }
38
+ }
39
+ },
40
+ categories: {
41
+ default: { appenders: ['stdout', 'info'], level: 'debug' },
42
+ error: { appenders: ['stdout', 'error'], level: 'error' },
43
+ webinfo: { appenders: ['stdout', 'webinfo'], level: 'debug' },
44
+ }
45
+ });
46
+ var MR;
47
+ (function (MR) {
48
+ MR.Logger = (0, log4js_1.getLogger)("default");
49
+ MR.ErrorLogger = (0, log4js_1.getLogger)("error");
50
+ MR.webLogger = (0, log4js_1.getLogger)("webinfo");
51
+ })(MR = exports.MR || (exports.MR = {}));
52
+ exports.default = MR.Logger;
@@ -0,0 +1,51 @@
1
+ import { Point } from "@nut-tree/nut-js";
2
+ export declare namespace MR {
3
+ class Mouse {
4
+ private constructor();
5
+ static setPosition(params: {
6
+ _x: number;
7
+ _y: number;
8
+ }): Promise<import("@nut-tree/nut-js").MouseClass>;
9
+ static get(): Promise<import("@nut-tree/nut-js").MouseClass>;
10
+ static getPosition(): Promise<Point>;
11
+ static getScreenCenterPosition(): Promise<Point>;
12
+ /**
13
+ * @param params
14
+ * @returns
15
+ */
16
+ static click(params?: {
17
+ _button?: "left" | "right" | "middle";
18
+ _count?: number;
19
+ _delay?: number;
20
+ }): Promise<void>;
21
+ static doubleClick(params?: {
22
+ _button?: "left" | "right" | "middle";
23
+ _count?: number;
24
+ _delay?: number;
25
+ }): Promise<void>;
26
+ static leftClick(): Promise<import("@nut-tree/nut-js").MouseClass>;
27
+ static leftDoubleClick(): Promise<import("@nut-tree/nut-js").MouseClass>;
28
+ static rightClick(): Promise<import("@nut-tree/nut-js").MouseClass>;
29
+ static drag(params: {
30
+ _x: number;
31
+ _y: number;
32
+ _width: number;
33
+ _height: number;
34
+ }): Promise<import("@nut-tree/nut-js").MouseClass>;
35
+ static move(params: {
36
+ _x: number;
37
+ _y: number;
38
+ }): Promise<import("@nut-tree/nut-js").MouseClass>;
39
+ static scroll(params?: {
40
+ _direction: "Down" | "Up" | "Left" | "Right";
41
+ _amount: number;
42
+ }): Promise<void>;
43
+ static moveLeft(offset: number): Promise<import("@nut-tree/nut-js").MouseClass>;
44
+ static moveRight(offset: number): Promise<import("@nut-tree/nut-js").MouseClass>;
45
+ static moveDown(offset: number): Promise<import("@nut-tree/nut-js").MouseClass>;
46
+ static moveUp(offset: number): Promise<import("@nut-tree/nut-js").MouseClass>;
47
+ static scrollLeft(offset: number): Promise<void>;
48
+ }
49
+ }
50
+ declare const _default: typeof MR.Mouse;
51
+ export default _default;