@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 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("\n")[0].trim();
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: "ignore",
120
+ stdio: 'ignore',
121
121
  }).unref();
122
122
  }
package/dist/config.js CHANGED
@@ -5,6 +5,6 @@ exports.visorConfig = {
5
5
  initialized: false,
6
6
  scaleFactor: 1,
7
7
  debug: true,
8
- imagePath: "",
9
- outputPath: ""
8
+ imagePath: '',
9
+ outputPath: '',
10
10
  };
package/dist/dialog.js CHANGED
@@ -15,18 +15,18 @@ function execAsync(command) {
15
15
  });
16
16
  });
17
17
  }
18
- async function alert(message, title = "Visor") {
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 = "Visor") {
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() === "Yes";
27
+ return result.trim() === 'Yes';
28
28
  }
29
- async function prompt(message, title = "Visor") {
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 (error) {
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 (e) {
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 "@nut-tree-fork/nut-js";
2
- import { Offset, Region } from "./types";
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
- * Moves the mouse cursor to the
12
- * center of a specific screen region.
13
- *
14
- * Region coordinates typically come from:
15
- * - visor.find()
16
- * - visor.findAll()
17
- * - OCR text matching
18
- * - Visor Inspector
19
- *
20
- * Display scaling is automatically
21
- * applied using the configured
22
- * scale factor.
23
- *
24
- * @param region Screen region coordinates.
25
- * @param offset Offset coords.
26
- *
27
- * @example
28
- * await visor.moveToRegion({
29
- * x: 100,
30
- * y: 200,
31
- * width: 150,
32
- * height: 50
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
- * Performs a left mouse click at the
38
- * center of a specific screen region.
39
- *
40
- * Region coordinates typically come from:
41
- * - visor.find()
42
- * - visor.findAll()
43
- * - OCR text matching
44
- * - Visor Inspector
45
- *
46
- * Display scaling is automatically
47
- * applied using the configured
48
- * scale factor.
49
- *
50
- * @param region Screen region coordinates.
51
- * @param offset Offset coords.
52
- *
53
- * @example
54
- * await visor.clickRegion({
55
- * x: 100,
56
- * y: 200,
57
- * width: 150,
58
- * height: 50
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
- * Performs a double left mouse click
64
- * at the center of a specific
65
- * screen region.
66
- *
67
- * Region coordinates typically come from:
68
- * - visor.find()
69
- * - visor.findAll()
70
- * - OCR text matching
71
- * - Visor Inspector
72
- *
73
- * Display scaling is automatically
74
- * applied using the configured
75
- * scale factor.
76
- *
77
- * @param region Screen region coordinates.
78
- * @param offset Offset coords.
79
- *
80
- * @example
81
- * await visor.doubleClickRegion({
82
- * x: 100,
83
- * y: 200,
84
- * width: 150,
85
- * height: 50
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
- * Performs a right mouse click at the
91
- * center of a specific screen region.
92
- *
93
- * Region coordinates typically come from:
94
- * - visor.find()
95
- * - visor.findAll()
96
- * - OCR text matching
97
- * - Visor Inspector
98
- *
99
- * Display scaling is automatically
100
- * applied using the configured
101
- * scale factor.
102
- *
103
- * @param region Screen region coordinates.
104
- * @param offset Offset coords.
105
- *
106
- * @example
107
- * await visor.rightClickRegion({
108
- * x: 100,
109
- * y: 200,
110
- * width: 150,
111
- * height: 50
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
- * Executes a command and returns output.
1002
- *
1003
- * @example
1004
- * const output =
1005
- * await visor.exec("ipconfig");
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
- * Starts a command without waiting
1010
- * for completion.
1011
- *
1012
- * @example
1013
- * await visor.execDetached(
1014
- * "notepad"
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
- * Generates a alert box.
1029
- *
1030
- * @param message Text to display.
1031
- * @param title Title of the alert.
1032
- *
1033
- * @example
1034
- * await visor.alert("Execution Completed");
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
- * Generates a conform box with Yes/No.
1039
- *
1040
- * @param message Text to display.
1041
- * @param title Title of the window.
1042
- *
1043
- * @example
1044
- * await visor.conform("Continue Execution?");
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
- * Generates a input box.
1049
- *
1050
- * @param message Text to display.
1051
- * @param title Title of the window.
1052
- *
1053
- * @example
1054
- * await visor.input("Enter Email");
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 "./types";
1060
- export type { Offset } from "./types";
1075
+ export { Region } from './types';
1076
+ export type { Offset } from './types';
1077
+ export { initializeOCR } from './ocr';