用于检测用户提示的 VBS 脚本
有没有办法使用 VBscript 检测何时出现用户提示?我正在运行一个脚本,该脚本使用 sendkeys 来响应用户提示,但其中一个提示的出现时间存在很大差异。
谢谢 -尼尔
Is there a way to detect when a user prompt appears using a VBscript? I have a script running that's using sendkeys to respond to user prompts, but one of the prompts is heavily variable in how long it will appear.
Thanks
-Neil
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定您的用户提示是什么意思,但我假设在这个答案中它是向用户显示的某种窗口/对话框。
如果是这种情况,您可能只需在脚本中执行某种循环并反复查看它是否存在。您可以使用 Windows API 函数来完成此操作。哪个最好取决于您的情况,但我建议您查看 EnumWindows, FindWindow 和 FindWindowEx,它应该可以让您找到提示。
如果您之前没有使用过 VBScript 中的 Win API,您可以找到如何调用这些方法的示例
I'm not exactly sure what you mean with user prompt, but I'm assuming in this answer that it's some kind of window/dialog that appears to the user.
If that's the case, you could probably just do some kind of loop in your script and repeatedly look if it exists. You can do this using Windows API functions. Which ones would be best depends a bit on your situation, but I'd suggest that you look at EnumWindows, FindWindow and FindWindowEx, which should let you find the prompt.
If you've not used Win API from VBScript before, you can find a sample of how to call those methods here.