VBS script to detect a user prompt
Is there a wa开发者_运维问答y 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 -NeilI'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.
精彩评论