@aspiresys/visor 1.3.5 → 1.4.1
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.
- package/dist/app.js +2 -2
- package/dist/config.js +2 -2
- package/dist/dialog.js +4 -4
- package/dist/display.js +2 -2
- package/dist/index.d.ts +156 -139
- package/dist/index.js +201 -164
- package/dist/inspector/index.js +10 -8
- package/dist/matcher.d.ts +1 -1
- package/dist/matcher.js +43 -33
- package/dist/mouse.d.ts +1 -1
- package/dist/mouse.js +4 -4
- package/dist/ocr.d.ts +2 -1
- package/dist/ocr.js +15 -15
- package/dist/path.js +1 -1
- package/dist/region.js +3 -4
- package/dist/screen.js +5 -5
- package/dist/src/index.js +15 -16
- package/dist/src/matcher.d.ts +1 -1
- package/dist/src/matcher.js +13 -12
- package/dist/src/mouse.d.ts +1 -1
- package/dist/src/mouse.js +9 -11
- package/dist/src/screen.js +12 -10
- package/dist/src/types.js +2 -2
- package/dist/templateMetadata.js +8 -2
- package/dist/text.d.ts +1 -1
- package/dist/text.js +8 -8
- package/dist/types.d.ts +249 -159
- package/dist/types.js +330 -170
- package/dist/version.d.ts +1 -0
- package/dist/version.js +18 -0
- package/inspector/index.html +82 -55
- package/inspector/main.js +135 -207
- package/inspector/src/preload.js +10 -15
- package/inspector/src/renderer.js +180 -235
- package/inspector/start.js +8 -16
- package/inspector/styles.css +456 -458
- package/package.json +57 -51
- package/readme.md +790 -799
package/dist/app.js
CHANGED
|
@@ -65,7 +65,7 @@ async function openApp(target) {
|
|
|
65
65
|
if (!resolved) {
|
|
66
66
|
throw new Error(`App not found: ${target}`);
|
|
67
67
|
}
|
|
68
|
-
const firstPath = resolved.split(
|
|
68
|
+
const firstPath = resolved.split('\n')[0].trim();
|
|
69
69
|
(0, logger_1.log)(`[APP] Resolved path: ${firstPath}`);
|
|
70
70
|
(0, child_process_1.exec)(`start "" "${firstPath}"`);
|
|
71
71
|
await new Promise((r) => setTimeout(r, 5000));
|
|
@@ -117,6 +117,6 @@ async function execDetached(command) {
|
|
|
117
117
|
(0, child_process_1.spawn)(command, [], {
|
|
118
118
|
detached: true,
|
|
119
119
|
shell: true,
|
|
120
|
-
stdio:
|
|
120
|
+
stdio: 'ignore',
|
|
121
121
|
}).unref();
|
|
122
122
|
}
|
package/dist/config.js
CHANGED
package/dist/dialog.js
CHANGED
|
@@ -15,18 +15,18 @@ function execAsync(command) {
|
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
async function alert(message, title =
|
|
18
|
+
async function alert(message, title = 'Visor') {
|
|
19
19
|
const command = `powershell -Command "Add-Type -AssemblyName PresentationFramework; [System.Windows.MessageBox]::Show('${message}','${title}') | Out-Null"`;
|
|
20
20
|
await execAsync(command);
|
|
21
21
|
}
|
|
22
|
-
async function confirm(message, title =
|
|
22
|
+
async function confirm(message, title = 'Visor') {
|
|
23
23
|
const command = `powershell -Command "Add-Type -AssemblyName PresentationFramework; ` +
|
|
24
24
|
`$result=[System.Windows.MessageBox]::Show('${message}','${title}','YesNo'); ` +
|
|
25
25
|
`Write-Output $result"`;
|
|
26
26
|
const result = await execAsync(command);
|
|
27
|
-
return result.trim() ===
|
|
27
|
+
return result.trim() === 'Yes';
|
|
28
28
|
}
|
|
29
|
-
async function prompt(message, title =
|
|
29
|
+
async function prompt(message, title = 'Visor') {
|
|
30
30
|
const command = `powershell -Command "Add-Type -AssemblyName Microsoft.VisualBasic; ` +
|
|
31
31
|
`[Microsoft.VisualBasic.Interaction]::InputBox('${message}','${title}')"`;
|
|
32
32
|
return await execAsync(command);
|
package/dist/display.js
CHANGED
|
@@ -13,7 +13,7 @@ function getWindowsScaleFactor() {
|
|
|
13
13
|
const calculatedScale = Math.round((hardwareWidth / logicalWidth) * 100);
|
|
14
14
|
return calculatedScale / 100;
|
|
15
15
|
}
|
|
16
|
-
catch
|
|
16
|
+
catch {
|
|
17
17
|
try {
|
|
18
18
|
const regCmd = `powershell -NoProfile -Command "(Get-ItemProperty 'HKCU:\\Control Panel\\Desktop\\PerMonitorSettings\\*').DpiScale | Select-Object -First 1"`;
|
|
19
19
|
const regVal = parseInt((0, child_process_1.execSync)(regCmd).toString().trim(), 10);
|
|
@@ -22,7 +22,7 @@ function getWindowsScaleFactor() {
|
|
|
22
22
|
return (indexMap[regVal] || 100) / 100;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
catch
|
|
25
|
+
catch {
|
|
26
26
|
return 1;
|
|
27
27
|
}
|
|
28
28
|
return 1;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Key, Button, Point } from
|
|
2
|
-
import { Offset, Region } from
|
|
1
|
+
import { Key, Button, Point } from '@nut-tree-fork/nut-js';
|
|
2
|
+
import { Offset, Region } from './types';
|
|
3
3
|
declare class Visor {
|
|
4
4
|
private mouse;
|
|
5
5
|
private keyboard;
|
|
@@ -8,109 +8,124 @@ declare class Visor {
|
|
|
8
8
|
private configWarningShown;
|
|
9
9
|
private checkConfig;
|
|
10
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
|
-
|
|
11
|
+
* Returns the currently installed
|
|
12
|
+
* Visor package version.
|
|
13
|
+
*
|
|
14
|
+
* Useful for:
|
|
15
|
+
* - debugging
|
|
16
|
+
* - support tickets
|
|
17
|
+
* - framework validation
|
|
18
|
+
*
|
|
19
|
+
* @returns Package version string.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* console.log(visor.version());
|
|
23
|
+
*/
|
|
24
|
+
version(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Moves the mouse cursor to the
|
|
27
|
+
* center of a specific screen region.
|
|
28
|
+
*
|
|
29
|
+
* Region coordinates typically come from:
|
|
30
|
+
* - visor.find()
|
|
31
|
+
* - visor.findAll()
|
|
32
|
+
* - OCR text matching
|
|
33
|
+
* - Visor Inspector
|
|
34
|
+
*
|
|
35
|
+
* Display scaling is automatically
|
|
36
|
+
* applied using the configured
|
|
37
|
+
* scale factor.
|
|
38
|
+
*
|
|
39
|
+
* @param region Screen region coordinates.
|
|
40
|
+
* @param offset Offset coords.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* await visor.moveToRegion({
|
|
44
|
+
* x: 100,
|
|
45
|
+
* y: 200,
|
|
46
|
+
* width: 150,
|
|
47
|
+
* height: 50
|
|
48
|
+
* });
|
|
49
|
+
*/
|
|
35
50
|
moveToRegion(region: Region, offset?: Offset): Promise<void>;
|
|
36
51
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
* Performs a left mouse click at the
|
|
53
|
+
* center of a specific screen region.
|
|
54
|
+
*
|
|
55
|
+
* Region coordinates typically come from:
|
|
56
|
+
* - visor.find()
|
|
57
|
+
* - visor.findAll()
|
|
58
|
+
* - OCR text matching
|
|
59
|
+
* - Visor Inspector
|
|
60
|
+
*
|
|
61
|
+
* Display scaling is automatically
|
|
62
|
+
* applied using the configured
|
|
63
|
+
* scale factor.
|
|
64
|
+
*
|
|
65
|
+
* @param region Screen region coordinates.
|
|
66
|
+
* @param offset Offset coords.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* await visor.clickRegion({
|
|
70
|
+
* x: 100,
|
|
71
|
+
* y: 200,
|
|
72
|
+
* width: 150,
|
|
73
|
+
* height: 50
|
|
74
|
+
* });
|
|
75
|
+
*/
|
|
61
76
|
clickRegion(region: Region, offset?: Offset): Promise<void>;
|
|
62
77
|
/**
|
|
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
|
-
|
|
78
|
+
* Performs a double left mouse click
|
|
79
|
+
* at the center of a specific
|
|
80
|
+
* screen region.
|
|
81
|
+
*
|
|
82
|
+
* Region coordinates typically come from:
|
|
83
|
+
* - visor.find()
|
|
84
|
+
* - visor.findAll()
|
|
85
|
+
* - OCR text matching
|
|
86
|
+
* - Visor Inspector
|
|
87
|
+
*
|
|
88
|
+
* Display scaling is automatically
|
|
89
|
+
* applied using the configured
|
|
90
|
+
* scale factor.
|
|
91
|
+
*
|
|
92
|
+
* @param region Screen region coordinates.
|
|
93
|
+
* @param offset Offset coords.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* await visor.doubleClickRegion({
|
|
97
|
+
* x: 100,
|
|
98
|
+
* y: 200,
|
|
99
|
+
* width: 150,
|
|
100
|
+
* height: 50
|
|
101
|
+
* });
|
|
102
|
+
*/
|
|
88
103
|
doubleClickRegion(region: Region, offset?: Offset): Promise<void>;
|
|
89
104
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
* Performs a right mouse click at the
|
|
106
|
+
* center of a specific screen region.
|
|
107
|
+
*
|
|
108
|
+
* Region coordinates typically come from:
|
|
109
|
+
* - visor.find()
|
|
110
|
+
* - visor.findAll()
|
|
111
|
+
* - OCR text matching
|
|
112
|
+
* - Visor Inspector
|
|
113
|
+
*
|
|
114
|
+
* Display scaling is automatically
|
|
115
|
+
* applied using the configured
|
|
116
|
+
* scale factor.
|
|
117
|
+
*
|
|
118
|
+
* @param region Screen region coordinates.
|
|
119
|
+
* @param offset Offset coords.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* await visor.rightClickRegion({
|
|
123
|
+
* x: 100,
|
|
124
|
+
* y: 200,
|
|
125
|
+
* width: 150,
|
|
126
|
+
* height: 50
|
|
127
|
+
* });
|
|
128
|
+
*/
|
|
114
129
|
rightClickRegion(region: Region, offset?: Offset): Promise<void>;
|
|
115
130
|
/**
|
|
116
131
|
* Finds an image on screen using OpenCV
|
|
@@ -770,6 +785,7 @@ declare class Visor {
|
|
|
770
785
|
* visor.getImagePath();
|
|
771
786
|
*/
|
|
772
787
|
getImagePath(): string;
|
|
788
|
+
showConfig(): void;
|
|
773
789
|
/**
|
|
774
790
|
* Sets the default output path
|
|
775
791
|
* used for visual automation APIs.
|
|
@@ -998,22 +1014,22 @@ declare class Visor {
|
|
|
998
1014
|
*/
|
|
999
1015
|
terminateOCR(): Promise<void>;
|
|
1000
1016
|
/**
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1017
|
+
* Executes a command and returns output.
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* const output =
|
|
1021
|
+
* await visor.exec("ipconfig");
|
|
1022
|
+
*/
|
|
1007
1023
|
exec(command: string): Promise<string>;
|
|
1008
1024
|
/**
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1025
|
+
* Starts a command without waiting
|
|
1026
|
+
* for completion.
|
|
1027
|
+
*
|
|
1028
|
+
* @example
|
|
1029
|
+
* await visor.execDetached(
|
|
1030
|
+
* "notepad"
|
|
1031
|
+
* );
|
|
1032
|
+
*/
|
|
1017
1033
|
execDetached(command: string): Promise<void>;
|
|
1018
1034
|
/**
|
|
1019
1035
|
* Pastes text using keyboard automation.
|
|
@@ -1025,36 +1041,37 @@ declare class Visor {
|
|
|
1025
1041
|
*/
|
|
1026
1042
|
paste(text: string): Promise<void>;
|
|
1027
1043
|
/**
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1044
|
+
* Generates a alert box.
|
|
1045
|
+
*
|
|
1046
|
+
* @param message Text to display.
|
|
1047
|
+
* @param title Title of the alert.
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* await visor.alert("Execution Completed");
|
|
1051
|
+
*/
|
|
1036
1052
|
alert(message: string, title?: string): Promise<void>;
|
|
1037
1053
|
/**
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1054
|
+
* Generates a conform box with Yes/No.
|
|
1055
|
+
*
|
|
1056
|
+
* @param message Text to display.
|
|
1057
|
+
* @param title Title of the window.
|
|
1058
|
+
*
|
|
1059
|
+
* @example
|
|
1060
|
+
* await visor.conform("Continue Execution?");
|
|
1061
|
+
*/
|
|
1046
1062
|
confirm(message: string, title?: string): Promise<boolean>;
|
|
1047
1063
|
/**
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1064
|
+
* Generates a input box.
|
|
1065
|
+
*
|
|
1066
|
+
* @param message Text to display.
|
|
1067
|
+
* @param title Title of the window.
|
|
1068
|
+
*
|
|
1069
|
+
* @example
|
|
1070
|
+
* await visor.input("Enter Email");
|
|
1071
|
+
*/
|
|
1056
1072
|
input(message: string, title?: string): Promise<string>;
|
|
1057
1073
|
}
|
|
1058
1074
|
export declare const visor: Visor;
|
|
1059
|
-
export { Region } from
|
|
1060
|
-
export type { Offset } from
|
|
1075
|
+
export { Region } from './types';
|
|
1076
|
+
export type { Offset } from './types';
|
|
1077
|
+
export { initializeOCR } from './ocr';
|