rust-rpa 0.2.4 → 0.2.5
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 +30 -0
- package/index.d.ts +18 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -591,6 +591,36 @@ if (targetWindow) {
|
|
|
591
591
|
|
|
592
592
|
## 更新日志
|
|
593
593
|
|
|
594
|
+
### 0.2.5
|
|
595
|
+
|
|
596
|
+
#### 改进
|
|
597
|
+
|
|
598
|
+
- **Window.watchChanges 优化**: `threshold` 参数默认值改为 `0.0`,并优化为 `0` 时跳过图像对比
|
|
599
|
+
- `threshold: 0`(默认)- 跳过像素对比,每次轮询直接触发回调,最低延迟
|
|
600
|
+
- `threshold > 0` - 执行降采样对比,变化比例超过阈值才触发回调
|
|
601
|
+
- 适用于已知窗口会变化、需要立即获取截图的场景
|
|
602
|
+
|
|
603
|
+
### 0.2.5
|
|
604
|
+
|
|
605
|
+
#### 新功能
|
|
606
|
+
|
|
607
|
+
- **findText / waitText / clickText 新增 `index` 参数**: 支持选择第几个匹配的文字结果
|
|
608
|
+
- `index` 默认为 `0`,返回第一个匹配结果
|
|
609
|
+
- 正数表示第 n 个(从 0 开始):`index: 1` 返回第二个
|
|
610
|
+
- 负数表示倒数第 n 个:`index: -1` 返回最后一个,`index: -2` 返回倒数第二个
|
|
611
|
+
- 超出匹配数量范围时返回 `null`
|
|
612
|
+
- 适用场景:页面中存在多个相同文字,需要点击特定位置
|
|
613
|
+
- 示例:`findText('确定', { index: 1 })` 查找第二个「确定」,`clickText('确定', { index: -2 })` 点击倒数第二个「确定」
|
|
614
|
+
|
|
615
|
+
#### 类型定义更新
|
|
616
|
+
|
|
617
|
+
- `FindTextOptions` 新增 `index?: number` 字段
|
|
618
|
+
- `WindowFindTextOptions` 新增 `index?: number` 字段
|
|
619
|
+
- `MonitorFindTextOptions` 新增 `index?: number` 字段
|
|
620
|
+
- `WindowWaitOptions` 新增 `index?: number` 字段
|
|
621
|
+
- `MonitorWaitOptions` 新增 `index?: number` 字段
|
|
622
|
+
- `WaitOptions` 新增 `index?: number` 字段
|
|
623
|
+
|
|
594
624
|
### 0.2.4
|
|
595
625
|
|
|
596
626
|
#### 新功能
|
package/index.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface FindTextOptions {
|
|
|
60
60
|
regions?: Array<MatchRegion>
|
|
61
61
|
/** 排除文字,若同一行中包含此文字则排除该匹配结果 */
|
|
62
62
|
notText?: string
|
|
63
|
+
/** 匹配索引,默认为 0(第一个匹配)。负数表示倒数:-1 最后一个,-2 倒数第二个 */
|
|
64
|
+
index?: number
|
|
63
65
|
}
|
|
64
66
|
/** 文字查找选项(Window 专用) */
|
|
65
67
|
export interface WindowFindTextOptions {
|
|
@@ -73,6 +75,8 @@ export interface WindowFindTextOptions {
|
|
|
73
75
|
* - `'screen'`:截取窗口所在显示器的整屏
|
|
74
76
|
*/
|
|
75
77
|
from?: 'window' | 'screen'
|
|
78
|
+
/** 匹配索引,默认为 0(第一个匹配)。负数表示倒数:-1 最后一个,-2 倒数第二个 */
|
|
79
|
+
index?: number
|
|
76
80
|
}
|
|
77
81
|
/** 文字查找选项(Monitor 专用) */
|
|
78
82
|
export interface MonitorFindTextOptions {
|
|
@@ -80,6 +84,8 @@ export interface MonitorFindTextOptions {
|
|
|
80
84
|
regions?: Array<MatchRegion>
|
|
81
85
|
/** 排除文字,若同一行中包含此文字则排除该匹配结果 */
|
|
82
86
|
notText?: string
|
|
87
|
+
/** 匹配索引,默认为 0(第一个匹配)。负数表示倒数:-1 最后一个,-2 倒数第二个 */
|
|
88
|
+
index?: number
|
|
83
89
|
}
|
|
84
90
|
/** 文字识别选项(ImageData 使用) */
|
|
85
91
|
export interface RecognizeTextOptions {
|
|
@@ -118,6 +124,8 @@ export interface WindowWaitOptions {
|
|
|
118
124
|
* - `'screen'`:截取窗口所在显示器的整屏
|
|
119
125
|
*/
|
|
120
126
|
from?: 'window' | 'screen'
|
|
127
|
+
/** 匹配索引,默认为 0(第一个匹配)。负数表示倒数:-1 最后一个,-2 倒数第二个(仅用于 waitText/clickText) */
|
|
128
|
+
index?: number
|
|
121
129
|
}
|
|
122
130
|
/** 等待选项(Monitor 专用) */
|
|
123
131
|
export interface MonitorWaitOptions {
|
|
@@ -129,6 +137,8 @@ export interface MonitorWaitOptions {
|
|
|
129
137
|
threshold?: number
|
|
130
138
|
/** 排除文字,若同一行中包含此文字则排除该匹配结果(仅用于 waitText/clickText) */
|
|
131
139
|
notText?: string
|
|
140
|
+
/** 匹配索引,默认为 0(第一个匹配)。负数表示倒数:-1 最后一个,-2 倒数第二个(仅用于 waitText/clickText) */
|
|
141
|
+
index?: number
|
|
132
142
|
}
|
|
133
143
|
/** 等待选项(兼容旧代码,与 WindowWaitOptions 相同) */
|
|
134
144
|
export interface WaitOptions {
|
|
@@ -146,6 +156,8 @@ export interface WaitOptions {
|
|
|
146
156
|
* - `'screen'`:截取窗口所在显示器的整屏
|
|
147
157
|
*/
|
|
148
158
|
from?: 'window' | 'screen'
|
|
159
|
+
/** 匹配索引,默认为 0(第一个匹配)。负数表示倒数:-1 最后一个,-2 倒数第二个(仅用于 waitText/clickText) */
|
|
160
|
+
index?: number
|
|
149
161
|
}
|
|
150
162
|
/** 图标匹配结果 */
|
|
151
163
|
export interface MatchResult {
|
|
@@ -246,7 +258,12 @@ export interface CaptureSizeJs {
|
|
|
246
258
|
}
|
|
247
259
|
/** 窗口变化监听的选项 */
|
|
248
260
|
export interface WindowWatchOptionsJs {
|
|
249
|
-
/**
|
|
261
|
+
/**
|
|
262
|
+
* 变化检测的灵敏度阈值 (0.0-1.0),默认 0.0
|
|
263
|
+
*
|
|
264
|
+
* - 0.0 表示跳过对比,每次轮询都触发回调(最敏感,最低延迟)
|
|
265
|
+
* - 大于 0.0 时,仅当像素变化比例超过阈值才触发回调
|
|
266
|
+
*/
|
|
250
267
|
threshold?: number
|
|
251
268
|
/** 图片来源:'window'(默认)或 'screen' */
|
|
252
269
|
from?: 'window' | 'screen'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-rpa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Rust-based RPA automation library for Node.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "index.js",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"commander": "^14.0.3"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"@alibot/rust-rpa-win32-x64-msvc": "0.2.
|
|
71
|
-
"@alibot/rust-rpa-win32-ia32-msvc": "0.2.
|
|
72
|
-
"@alibot/rust-rpa-darwin-x64": "0.2.
|
|
73
|
-
"@alibot/rust-rpa-darwin-arm64": "0.2.
|
|
70
|
+
"@alibot/rust-rpa-win32-x64-msvc": "0.2.5",
|
|
71
|
+
"@alibot/rust-rpa-win32-ia32-msvc": "0.2.5",
|
|
72
|
+
"@alibot/rust-rpa-darwin-x64": "0.2.5",
|
|
73
|
+
"@alibot/rust-rpa-darwin-arm64": "0.2.5"
|
|
74
74
|
}
|
|
75
75
|
}
|