Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automtically choose "yes" when prompted 1

Status
Not open for further replies.
May 11, 2004
37
US
I have a very simple script that runs an .exe. The problem is that the installation program prompts me w/ a question and I must choose yes to continue. Is there any way to add a line to the scipt so that "yes" is chose automatically?

Many Thanks,

Rich
 
Take a look at AppActivate and SendKeys.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
There are a few options.
1) If the exe you are running accepts some command line parameter so that it defaults to Yes, then include that in your run command. This would be the best option.
2) If the program you are running exposes an API, you may be able to instantiate an object to control the app directly. This would be the next best but least likely option.
3) Use AppActivate and SendKeys to select yes.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Ah, good call, send keys might be easiest for now. I'll give that a shot. Thanks so much!
 
Well, I am having a problem w/ sendkeys. The program goes nuts as if the enter key was hit 100 times. Is this the correct syntax?

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "c:\rasetup.exe"
objShell.SendKeys "~"


Thanks very much
 
Try using AppActivate first to be sure that your app has focus. Also use a sleep after the run to be sure that the app has time to start.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Outstanding!! This works like a charm:

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "c:\rasetup.exe"

objShell.AppActivate "c:\rasetup.exe"
WScript.Sleep 100
objShell.SendKeys "~"


Thanks for your vision!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top