取消令牌源
动词:cancelToken
取消与取消令牌关联的命令的连续操作。
语法
cancelToken --token(CancellationTokenSource)
输入
| 脚本 | 设计器 | 必需的 | AcceptedTypes | 描述 |
|---|---|---|---|---|
| --token | 取消令牌源 | 必需的 | 取消令牌源 | 取消令牌(由连续执行命令返回)用于管理应取消的命令。 |
示例
等待正则表达式识别的“记事本”窗口。 每次使用启动并附加窗口命令打开“记事本”窗口时,使用监视并关闭窗口命令会自动关闭窗口。 通过存储在令牌参数中的取消令牌,使用取消令牌源命令取消连续操作,并且“记事本”窗口不再自动关闭。
defVar --name windowNotepad --type Window
defVar --name token --type CancellationTokenSource
watchAndCloseWindow --useregex --regexPattern Notepad --regexOptions "IgnoreCase" --processname notepad --recursive token=value
launchWindow --executablepath "C:\\Windows\\notepad.exe" windowNotepad=value
launchWindow --executablepath "C:\\Windows\\notepad.exe" windowNotepad=value
cancelToken --token ${token}
launchWindow --executablepath "C:\\Windows\\notepad.exe" windowNotepad=value
//watchAndCloseWindow automatically closes new Notepad windows.
//After canceling the continuous action with the Cancel Token Source command, new Notepad windows are no longer closed.
备注
一些连续的执行命令(例如监视和关闭窗口和在浏览器中监视和设置凭证)返回取消令牌,取消令牌源命令可使用取消令牌以在设置令牌的过程中取消此类连续操作。