assistsx-js 0.0.2036 → 0.0.2038

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.
@@ -7,6 +7,37 @@ import { Bounds } from "./Bounds";
7
7
  import { AppInfo } from "./AppInfo";
8
8
  import { DeviceInfo } from "./DeviceInfo";
9
9
  import { WebFloatingWindowOptions } from "./AssistsX";
10
+ /**
11
+ * 截图识别位置信息
12
+ */
13
+ export interface RecognizeTextInScreenshotPosition {
14
+ text: string;
15
+ left: number;
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ /**
23
+ * 截图识别结果
24
+ */
25
+ export interface RecognizeTextInScreenshotResult {
26
+ fullText: string;
27
+ processingTimeMillis: number;
28
+ positions: RecognizeTextInScreenshotPosition[];
29
+ }
30
+ /**
31
+ * 截图识别区域参数
32
+ */
33
+ export interface RecognizeTextRegion {
34
+ left?: number;
35
+ top?: number;
36
+ right?: number;
37
+ bottom?: number;
38
+ width?: number;
39
+ height?: number;
40
+ }
10
41
  export declare class AssistsXAsync {
11
42
  /**
12
43
  * 执行异步调用
@@ -62,6 +93,18 @@ export declare class AssistsXAsync {
62
93
  * @returns 截图路径数组
63
94
  */
64
95
  static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number, timeout?: number): Promise<string[]>;
96
+ /**
97
+ * 截图识别文本
98
+ * @param param0 识别参数
99
+ * @returns 截图识别结果
100
+ */
101
+ static recognizeTextInScreenshot(targetText: string, { rotationDegrees, overlayHiddenScreenshotDelayMillis, restoreOverlay, region, timeout, }: {
102
+ rotationDegrees?: number;
103
+ overlayHiddenScreenshotDelayMillis?: number;
104
+ restoreOverlay?: boolean;
105
+ region?: RecognizeTextRegion;
106
+ timeout?: number;
107
+ }): Promise<RecognizeTextInScreenshotResult>;
65
108
  static scanQR(timeout?: number): Promise<string>;
66
109
  static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
67
110
  timeout?: number;
@@ -119,6 +119,28 @@ export class AssistsXAsync {
119
119
  const data = response.getDataOrDefault("");
120
120
  return data.images;
121
121
  }
122
+ /**
123
+ * 截图识别文本
124
+ * @param param0 识别参数
125
+ * @returns 截图识别结果
126
+ */
127
+ static async recognizeTextInScreenshot(targetText, { rotationDegrees, overlayHiddenScreenshotDelayMillis, restoreOverlay = true, region, timeout, }) {
128
+ const response = await this.asyncCall(CallMethod.recognizeTextInScreenshot, {
129
+ args: {
130
+ targetText,
131
+ rotationDegrees,
132
+ overlayHiddenScreenshotDelayMillis,
133
+ restoreOverlay,
134
+ region,
135
+ },
136
+ timeout,
137
+ });
138
+ return response.getDataOrDefault({
139
+ fullText: "",
140
+ processingTimeMillis: 0,
141
+ positions: [],
142
+ });
143
+ }
122
144
  static async scanQR(timeout) {
123
145
  const response = await this.asyncCall(CallMethod.scanQR, { timeout });
124
146
  const data = response.getDataOrDefault({ value: "" });
@@ -33,6 +33,7 @@ export declare const CallMethod: {
33
33
  readonly setOverlayFlags: "setOverlayFlags";
34
34
  readonly scanQR: "scanQR";
35
35
  readonly loadWebViewOverlay: "loadWebViewOverlay";
36
+ readonly recognizeTextInScreenshot: "recognizeTextInScreenshot";
36
37
  readonly clickByGesture: "clickByGesture";
37
38
  readonly clickNodeByGesture: "clickNodeByGesture";
38
39
  readonly doubleClickNodeByGesture: "doubleClickNodeByGesture";
@@ -34,6 +34,7 @@ export const CallMethod = {
34
34
  setOverlayFlags: "setOverlayFlags",
35
35
  scanQR: "scanQR",
36
36
  loadWebViewOverlay: "loadWebViewOverlay",
37
+ recognizeTextInScreenshot: "recognizeTextInScreenshot",
37
38
  clickByGesture: "clickByGesture",
38
39
  clickNodeByGesture: "clickNodeByGesture",
39
40
  doubleClickNodeByGesture: "doubleClickNodeByGesture",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2036",
3
+ "version": "0.0.2038",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -17,6 +17,40 @@ import {
17
17
  HttpResponse,
18
18
  } from "./AssistsX";
19
19
 
20
+ /**
21
+ * 截图识别位置信息
22
+ */
23
+ export interface RecognizeTextInScreenshotPosition {
24
+ text: string;
25
+ left: number;
26
+ top: number;
27
+ right: number;
28
+ bottom: number;
29
+ width: number;
30
+ height: number;
31
+ }
32
+
33
+ /**
34
+ * 截图识别结果
35
+ */
36
+ export interface RecognizeTextInScreenshotResult {
37
+ fullText: string;
38
+ processingTimeMillis: number;
39
+ positions: RecognizeTextInScreenshotPosition[];
40
+ }
41
+
42
+ /**
43
+ * 截图识别区域参数
44
+ */
45
+ export interface RecognizeTextRegion {
46
+ left?: number;
47
+ top?: number;
48
+ right?: number;
49
+ bottom?: number;
50
+ width?: number;
51
+ height?: number;
52
+ }
53
+
20
54
  export class AssistsXAsync {
21
55
  /**
22
56
  * 执行异步调用
@@ -167,6 +201,46 @@ export class AssistsXAsync {
167
201
  const data = response.getDataOrDefault("");
168
202
  return data.images;
169
203
  }
204
+ /**
205
+ * 截图识别文本
206
+ * @param param0 识别参数
207
+ * @returns 截图识别结果
208
+ */
209
+ public static async recognizeTextInScreenshot(
210
+ targetText: string,
211
+ {
212
+ rotationDegrees,
213
+ overlayHiddenScreenshotDelayMillis,
214
+ restoreOverlay = true,
215
+ region,
216
+ timeout,
217
+ }: {
218
+ rotationDegrees?: number;
219
+ overlayHiddenScreenshotDelayMillis?: number;
220
+ restoreOverlay?: boolean;
221
+ region?: RecognizeTextRegion;
222
+ timeout?: number;
223
+ }
224
+ ): Promise<RecognizeTextInScreenshotResult> {
225
+ const response = await this.asyncCall(
226
+ CallMethod.recognizeTextInScreenshot,
227
+ {
228
+ args: {
229
+ targetText,
230
+ rotationDegrees,
231
+ overlayHiddenScreenshotDelayMillis,
232
+ restoreOverlay,
233
+ region,
234
+ },
235
+ timeout,
236
+ }
237
+ );
238
+ return response.getDataOrDefault({
239
+ fullText: "",
240
+ processingTimeMillis: 0,
241
+ positions: [],
242
+ });
243
+ }
170
244
  public static async scanQR(timeout?: number): Promise<string> {
171
245
  const response = await this.asyncCall(CallMethod.scanQR, { timeout });
172
246
  const data = response.getDataOrDefault({ value: "" });
package/src/CallMethod.ts CHANGED
@@ -34,6 +34,7 @@ export const CallMethod = {
34
34
  setOverlayFlags: "setOverlayFlags",
35
35
  scanQR: "scanQR",
36
36
  loadWebViewOverlay: "loadWebViewOverlay",
37
+ recognizeTextInScreenshot: "recognizeTextInScreenshot",
37
38
 
38
39
  clickByGesture: "clickByGesture",
39
40
  clickNodeByGesture: "clickNodeByGesture",