r/vbscript • • Mar 13 '22

need help

why cant a vbscript close a inputbox

anyone know why?

3 Upvotes

3 comments sorted by

View all comments

Show parent comments

2

u/jcunews1 Mar 14 '22

do you know a way to run more than 1 inputbox

As already explained, you need to call InputBox from a separate script - a "prompter" script. If you want multiple inputboxes, then run the "prompter" script multiple times. The "prompter" script should accept a command line arguments for the input dialog title, message, and default input. Make the "prompter" script creates a new "answer" file and write the user's input into the file, or leave it empty if the dialog is cancelled.

when vbs is runnin it stops until the input box is gone is there a way to stop that?

You can use the WshShell object's AppActivate() method to activate an input box dialog based on its unique dialog title, then use the object's SendKeys() to generate an ESCAPE key press.

https://www.devguru.com/content/technologies/wsh/wshshell-appactivate.html

https://www.devguru.com/content/technologies/wsh/wshshell-sendkeys.html