@aspiresys/visor 1.2.10 → 1.3.0

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/readme.md CHANGED
@@ -18,13 +18,16 @@ Visor is designed for automating desktop workflows using visual interactions ins
18
18
  * OpenCV-based image matching
19
19
  * Multi-scale image matching
20
20
  * OCR automation using Tesseract
21
- * OCR occurrence indexing
21
+ * OCR occurrence indexing (beta)
22
22
  * Region OCR support
23
23
  * Automatic display scaling detection
24
24
  * Mouse automation
25
+ * Region-based mouse automation
26
+ * Region OCR support
27
+ * Region-based mouse automation
28
+ * Target offset support
25
29
  * Keyboard automation
26
30
  * Drag & drop support
27
- * Multi-theme image handling
28
31
  * Screenshot capture
29
32
  * Desktop application automation
30
33
  * OCR text searching
@@ -35,6 +38,17 @@ Visor is designed for automating desktop workflows using visual interactions ins
35
38
 
36
39
  ---
37
40
 
41
+ ## What's New in 1.3.0
42
+
43
+ * Region class API
44
+ * Region image matching
45
+ * Region OCR search
46
+ * Region interaction methods
47
+ * Improved Inspector workflow
48
+ * Target offset support
49
+
50
+ ---
51
+
38
52
  # Installation
39
53
 
40
54
  ```bash
@@ -51,10 +65,27 @@ npm install @aspiresys/visor
51
65
 
52
66
  ---
53
67
 
68
+ # Visor Inspector
69
+
70
+ Visor includes an optional desktop Inspector tool for:
71
+
72
+ * Capturing templates
73
+ * Testing image matches
74
+ * Measuring screen coordinates
75
+ * Validating confidence thresholds
76
+
77
+ Run:
78
+
79
+ ```bash
80
+ npx visor-inspector
81
+ ```
82
+
83
+ ---
84
+
54
85
  # Quick Start
55
86
 
56
87
  ```ts
57
- import { visor } from "@aspiresys/visor";
88
+ import { visor, Region } from "@aspiresys/visor";
58
89
 
59
90
  async function main() {
60
91
 
@@ -160,18 +191,215 @@ await visor.click("save.png");
160
191
 
161
192
  ## Find Image
162
193
 
194
+ ```ts
195
+ const region = await visor.find("icon.png");
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Region-Based Automation
201
+
202
+ Regions can be obtained from:
203
+
204
+ * visor.find()
205
+ * visor.findAll()
206
+ * visor.findText()
207
+ * Visor Inspector
208
+
209
+ ### Move To Region
210
+
163
211
  ```ts
164
212
  const region =
165
- await visor.find("icon.png");
213
+ await visor.find(
214
+ "save.png"
215
+ );
216
+
217
+ await visor.moveToRegion(
218
+ region
219
+ );
220
+ ```
221
+
222
+ ### Click Region
223
+
224
+ ```ts
225
+ const region =
226
+ await visor.find(
227
+ "save.png"
228
+ );
229
+
230
+ await visor.clickRegion(
231
+ region
232
+ );
233
+ ```
234
+
235
+ ### Double Click Region
236
+
237
+ ```ts
238
+ await visor.doubleClickRegion(new Region(
239
+ 100,
240
+ 200,
241
+ 150,
242
+ 50
243
+ ));
244
+ ```
245
+
246
+ ### Right Click Region
247
+
248
+ ```ts
249
+ await visor.rightClickRegion(new Region(
250
+ 100,
251
+ 200,
252
+ 150,
253
+ 50
254
+ ));
255
+ ```
256
+
257
+ Display scaling is automatically applied when using region-based APIs.
258
+
259
+ ---
260
+
261
+ # Region Object API
262
+
263
+ Regions returned by Visor are first-class objects that provide built-in automation methods.
264
+
265
+ Regions can be obtained from:
266
+
267
+ * visor.find()
268
+ * visor.findAll()
269
+ * visor.findText()
270
+ * Visor Inspector
271
+
272
+ Example:
273
+
274
+ ```ts
275
+ const dialog = await visor.find("dialog.png");
276
+
277
+ const save = await dialog.find("save.png");
278
+
279
+ await save.click();
166
280
  ```
167
281
 
168
282
  ---
169
283
 
284
+ ```md
285
+ ## Region.find()
286
+
287
+ Search for an image within the current region.
288
+ ```
289
+ ```ts
290
+ const dialog = await visor.find("dialog.png");
291
+
292
+ const save = await dialog.find("save.png");
293
+ ```
294
+
295
+ ---
296
+
297
+ ```md
298
+ ## Region.findAll()
299
+
300
+ Find all image matches within the current region.
301
+ ```
302
+ ```ts
303
+ const dialog = await visor.find("dialog.png");
304
+
305
+ const buttons = await dialog.findAll("button.png");
306
+ ```
307
+
308
+ ---
309
+
310
+ ```md
311
+ ## Region.exists()
312
+
313
+ Check whether an image exists within the current region.
314
+ ```
315
+ ```ts
316
+ const dialog = await visor.find("dialog.png");
317
+
318
+ const exists = await dialog.exists("save.png");
319
+ ```
320
+
321
+ ---
322
+
323
+ ```md
324
+ ## Region.findText()
325
+
326
+ Search for text within the current region.
327
+ ```
328
+ ```ts
329
+ const dialog = await visor.find("dialog.png");
330
+
331
+ const submit = await dialog.findText("Submit");
332
+ ```
333
+
334
+ ---
335
+
336
+ ```md
337
+ ## Region.existsText()
338
+
339
+ Check whether text exists within the current region.
340
+ ```
341
+ ```ts
342
+ const dialog = await visor.find("dialog.png");
343
+
344
+ const exists = await dialog.existsText("Success");
345
+ ```
346
+
347
+ ---
348
+
349
+ ```md
350
+ ## Region.readText()
351
+
352
+ Extract OCR text from the current region.
353
+ ```
354
+ ```ts
355
+ const dialog = await visor.find("dialog.png");
356
+
357
+ const result = await dialog.readText();
358
+
359
+ console.log(result.text);
360
+ ```
361
+
362
+ ---
363
+
364
+ ```md
365
+ ## Region.click()
366
+ ```
367
+ ```ts
368
+ const save = await visor.find("save.png");
369
+
370
+ await save.click();
371
+ ```
372
+
373
+ ---
374
+
375
+ ```md
376
+ ## Region.doubleClick()
377
+ ```
378
+ ```ts
379
+ await save.doubleClick();
380
+ ```
381
+ ---
382
+
383
+ ```md
384
+ ## Region.rightClick()
385
+ ```
386
+ ```ts
387
+ await save.rightClick();
388
+ ```
389
+ ---
390
+
391
+ ```md
392
+ ## Region.move()
393
+ ```
394
+ ```ts
395
+ await save.move();
396
+ ```
397
+ ---
398
+
170
399
  ## Check Image Exists
171
400
 
172
401
  ```ts
173
- const exists =
174
- await visor.exists("login.png");
402
+ const exists = await visor.exists("login.png");
175
403
  ```
176
404
 
177
405
  ---
@@ -230,6 +458,47 @@ await visor.hover("menu.png");
230
458
 
231
459
  ---
232
460
 
461
+ ## Target Offsets
462
+
463
+ Target offsets allow mouse actions to be performed relative to the center of a matched image.
464
+
465
+ Useful for:
466
+
467
+ * Dropdown arrows
468
+ * Adjacent controls
469
+ * Dynamic layouts
470
+ * Composite UI elements
471
+
472
+ ### Click With Offset
473
+
474
+ ```ts
475
+ await visor.click(
476
+ "search.png",
477
+ 0.8,
478
+ {
479
+ x: 50,
480
+ y: 0
481
+ }
482
+ );
483
+ ```
484
+
485
+ ### Hover With Offset
486
+
487
+ ```ts
488
+ await visor.hover(
489
+ "menu.png",
490
+ 0.8,
491
+ {
492
+ x: -20,
493
+ y: 10
494
+ }
495
+ );
496
+ ```
497
+
498
+ Offsets are applied relative to the center of the matched region before display scaling adjustments are performed.
499
+
500
+ ---
501
+
233
502
  # OCR Automation
234
503
 
235
504
  Visor includes OCR automation powered by Tesseract.js.
@@ -248,8 +517,7 @@ OCR supports:
248
517
  ## Read Screen
249
518
 
250
519
  ```ts
251
- const result =
252
- await visor.readScreen();
520
+ const result = await visor.readScreen();
253
521
 
254
522
  console.log(result.text);
255
523
  ```
@@ -260,12 +528,12 @@ console.log(result.text);
260
528
 
261
529
  ```ts
262
530
  const result =
263
- await visor.readRegion({
264
- x: 100,
265
- y: 100,
266
- width: 500,
267
- height: 300
268
- });
531
+ await visor.readRegion(new Region(
532
+ 100,
533
+ 100,
534
+ 500,
535
+ 300
536
+ ));
269
537
 
270
538
  console.log(result.text);
271
539
  ```
@@ -275,8 +543,7 @@ console.log(result.text);
275
543
  ## Find Text
276
544
 
277
545
  ```ts
278
- const region =
279
- await visor.findText("Submit");
546
+ const region = visor.findText("Submit");
280
547
  ```
281
548
 
282
549
  ---
@@ -351,6 +618,21 @@ await visor.moveMouse(
351
618
 
352
619
  ---
353
620
 
621
+ ### Move To Inspector Region
622
+
623
+ ```ts
624
+ await visor.moveToRegion(new Region(
625
+ 90,
626
+ 61,
627
+ 138,
628
+ 69
629
+ ));
630
+ ```
631
+
632
+ Region coordinates can be copied directly from Visor Inspector match results.
633
+
634
+ ---
635
+
354
636
  ## Scroll Down
355
637
 
356
638
  ```ts
@@ -370,8 +652,7 @@ await visor.scrollUp(1000);
370
652
  ## Mouse Position
371
653
 
372
654
  ```ts
373
- const pos =
374
- await visor.getMousePosition();
655
+ const pos = await visor.getMousePosition();
375
656
  ```
376
657
 
377
658
  ---
@@ -497,9 +778,9 @@ visor.loadConfig({
497
778
 
498
779
  # Roadmap
499
780
 
500
- * Template cache
501
- * OCR cache
502
- * Scale cache
781
+ * Match visualization overlay
782
+ * Inspector coordinate picker
783
+ * Multi-monitor support improvements
503
784
  * Parallel image matching
504
785
  * Advanced OCR tuning
505
786
  * Electron recorder