设置执行调速
动词:setThrottling
可从以下位置获取: <Enterprise>
指定用于执行与控件交互的命令的缺省时间间隔。
在 Windows 上下文中,控件是允许用户与应用程序进行交互的元素。 控件可以是按钮、数据输入字段、菜单和各种其他元素。
语法
setThrottling --timeout(TimeSpan)
输入
| 脚本 | 设计器 | 必需的 | AcceptedTypes | Description |
|---|---|---|---|---|
| --timeout | 超时 | 必需的 | 时间范围 | 时间间隔(小时,分钟和秒等) 以便可以识别 Windows 应用程序控件。如果指定的时间间隔小于识别控件所花费的时间,那么将正常执行脚本,但是执行时间与该参数指定的时间不同。 |
示例
使用设置执行调速命令将识别单击命令所使用的控件的时间间隔定义为 3 秒。 使用启用输出命令,以便在脚本执行结束时,可以查看执行每个命令所花的时间。
defVar --name window --type Window
// The "setProfiling" command allows you to see how long it took for each script command to execute.
setProfiling --on
// Set a time interval of 3 seconds to identify the controls of the commands subsequent to it, in this context, it will be the command "Click".
setThrottling --timeout 00:00:03
launchWindow --executablepath "mspaint.exe" window=value
// Click on the "Pencil" in the "Tools" tab.
click --selector "Name" --controlsimilarity 100 --name Pencil
// Click on the "Magnifier" in the "Tools" tab.
click --selector "Name" --controlsimilarity 100 --name Magnifier
要成功执行单击命令,必须使应用程序窗口足够大,以便可以看到“画笔”和“放大镜”按钮。 否则,无法映射这些控件。