@aspiresys/visor 1.2.11 → 1.3.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/readme.md CHANGED
@@ -18,15 +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
25
  * Region-based mouse automation
26
+ * Region OCR support
27
+ * Region-based mouse automation
26
28
  * Target offset support
27
29
  * Keyboard automation
28
30
  * Drag & drop support
29
- * Multi-theme image handling
30
31
  * Screenshot capture
31
32
  * Desktop application automation
32
33
  * OCR text searching
@@ -37,6 +38,17 @@ Visor is designed for automating desktop workflows using visual interactions ins
37
38
 
38
39
  ---
39
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
+
40
52
  # Installation
41
53
 
42
54
  ```bash
@@ -73,7 +85,7 @@ npx visor-inspector
73
85
  # Quick Start
74
86
 
75
87
  ```ts
76
- import { visor } from "@aspiresys/visor";
88
+ import { visor, Region } from "@aspiresys/visor";
77
89
 
78
90
  async function main() {
79
91
 
@@ -180,8 +192,7 @@ await visor.click("save.png");
180
192
  ## Find Image
181
193
 
182
194
  ```ts
183
- const region =
184
- await visor.find("icon.png");
195
+ const region = await visor.find("icon.png");
185
196
  ```
186
197
 
187
198
  ---
@@ -224,34 +235,171 @@ await visor.clickRegion(
224
235
  ### Double Click Region
225
236
 
226
237
  ```ts
227
- await visor.doubleClickRegion({
228
- x: 100,
229
- y: 200,
230
- width: 150,
231
- height: 50
232
- });
238
+ await visor.doubleClickRegion(new Region(
239
+ 100,
240
+ 200,
241
+ 150,
242
+ 50
243
+ ));
233
244
  ```
234
245
 
235
246
  ### Right Click Region
236
247
 
237
248
  ```ts
238
- await visor.rightClickRegion({
239
- x: 100,
240
- y: 200,
241
- width: 150,
242
- height: 50
243
- });
249
+ await visor.rightClickRegion(new Region(
250
+ 100,
251
+ 200,
252
+ 150,
253
+ 50
254
+ ));
244
255
  ```
245
256
 
246
257
  Display scaling is automatically applied when using region-based APIs.
247
258
 
248
259
  ---
249
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();
280
+ ```
281
+
282
+ ---
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
+
250
399
  ## Check Image Exists
251
400
 
252
401
  ```ts
253
- const exists =
254
- await visor.exists("login.png");
402
+ const exists = await visor.exists("login.png");
255
403
  ```
256
404
 
257
405
  ---
@@ -369,8 +517,7 @@ OCR supports:
369
517
  ## Read Screen
370
518
 
371
519
  ```ts
372
- const result =
373
- await visor.readScreen();
520
+ const result = await visor.readScreen();
374
521
 
375
522
  console.log(result.text);
376
523
  ```
@@ -381,12 +528,12 @@ console.log(result.text);
381
528
 
382
529
  ```ts
383
530
  const result =
384
- await visor.readRegion({
385
- x: 100,
386
- y: 100,
387
- width: 500,
388
- height: 300
389
- });
531
+ await visor.readRegion(new Region(
532
+ 100,
533
+ 100,
534
+ 500,
535
+ 300
536
+ ));
390
537
 
391
538
  console.log(result.text);
392
539
  ```
@@ -396,8 +543,7 @@ console.log(result.text);
396
543
  ## Find Text
397
544
 
398
545
  ```ts
399
- const region =
400
- await visor.findText("Submit");
546
+ const region = visor.findText("Submit");
401
547
  ```
402
548
 
403
549
  ---
@@ -475,12 +621,12 @@ await visor.moveMouse(
475
621
  ### Move To Inspector Region
476
622
 
477
623
  ```ts
478
- await visor.moveToRegion({
479
- x: 90,
480
- y: 61,
481
- width: 138,
482
- height: 69
483
- });
624
+ await visor.moveToRegion(new Region(
625
+ 90,
626
+ 61,
627
+ 138,
628
+ 69
629
+ ));
484
630
  ```
485
631
 
486
632
  Region coordinates can be copied directly from Visor Inspector match results.
@@ -506,8 +652,7 @@ await visor.scrollUp(1000);
506
652
  ## Mouse Position
507
653
 
508
654
  ```ts
509
- const pos =
510
- await visor.getMousePosition();
655
+ const pos = await visor.getMousePosition();
511
656
  ```
512
657
 
513
658
  ---