Is there a batch file command that closes a dialog box?
-
For windows batch files, is there a way to automatically close dialog boxes that open as a result of a windows program producing an error? I'm struggling trying to write a batch file for windows 2000 which does a variety of things on an hourly basis, one of which is to start a windows program to run. That program goes out on the internet and makes some checks, and the batch file works fine for that. The problem is when the computer loses an internet connection for some reason, the program cannot complete it's internet check and produces a single dialog indicating it couldn't connect, with one "OK" button on it. At that point the batch file hangs, because I have other events in the batch file which must occur, and they can't complete because I had to use the start and wait switch like this: Start /wait "" "windows program.exe" /run which forces the batch file to wait until the window program finishes execution, and only then continues to the next line of the batch file. If I can just get the batch file to automatically close the error dialog, then the batch file can proceed normally as I want. I'm fairly sure I'll need some sort of IF THEN statement to get this to work, but this is my first time trying to write a somewhat complicated batch file, and I'm not sure about how to integrate an IF THEN statement with some command to close that error dialog if it appears. Anybody have any experience in batch files and can lend me some ideas? Thanks.
-
Answer:
You can't do that from batch, but you can use some other tools to do this kind of thing. http://www.dialogdevil.com/index.php looks like it might do the trick. It says it costs money but there's a "download" link which looks like you can demo it.
jldindc at Ask.Metafilter.Com Visit the source
Other answers
You could have the batch file try to ping a known good host on the internet, then only if it can, run the other program. Or, give http://www.autoitscript.com/autoit3/a try.. a great scripting language with tons of windows support.
mattdini
Does "windows program.exe" happen to have a quite option? Such as /q? Most things that are meant to run from the command line do...
jeffamaphone
Yeah... seconding autoit. That thing is rad for scripting on windows, especially for dealing with other programs and dialog boxes.
ph00dz
Yeah, the simplest solution is to see if that program has a /quiet or a /y type of option that will keep it quiet. Use the 'start' command to call the program. type start /? to get all the options. This will start whatever program it is and continue processing the rest of the batch file without waiting for the first one to finish. Example: notepad.exe calc.exe Put that into test.bat and run it. Notepad will run. When you close it, calculator will run. However: start notepad.exe start calc.exe Will start them both and close the batch window instantly. And: start notepad.exe calc.exe Will start notepad and calc instantly, but will leave the batch window open until you close calculator.
gjc
Related Q & A:
- How to skip the input in batch file?Best solution by Stack Overflow
- How to run an interactive batch file on windows from a service?Best solution by Stack Overflow
- In Visual Studio 2012 or 2013, how can I register a DLL file on Windows 7 64-bit computer using a Custom Action command?Best solution by Stack Overflow
- How can i see my messages in the dialog box?Best solution by Yahoo! Answers
- How to make a batch file copy itself?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.