Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
ScumPuppy
- Posts: 2
- Joined: 09 Jul 2009 05:39
#1
Post
by ScumPuppy » 09 Jul 2009 05:44
Hi all
Can anyone please help me?
I need to get my batch file to open 3 web pages and 3 office documents one after another. The difficult part is making it WAIT until each one has opened properly and fully before opening the next.
I have tried the Start /wait command but I cant get this working correctly.
My problem is also that when I try and open multiple office documents say a word and excel file, it opens the word file and wont open the excel file until I close the word file
can anyone help?
I need it to open 3 URL's in explorer and 1 word, 1 excel and 1 powerpoint file all in sequence and to wait until the one before it is fully opened before opening the next one IF thats possible

-
jeb
- Expert
- Posts: 1057
- Joined: 30 Aug 2007 08:05
- Location: Germany, Bochum
#2
Post
by jeb » 09 Jul 2009 07:40
Hi ScumPuppy,
I suppose there is no simple way.
Your problem is, that you only want to wait until the program is opened not until it is closed.
Therefore the "start /wait" can't work.
The solution have to be start the program, and the poll until it is opened completly.
The polling could be done with "findWindow" or another windows api function.
But then you need a little none DOS-BATCH program.
Try a look at sysinternals
http://www.microsoft.com/technet/sysinternals
Hope it helps
jeb
-
ScumPuppy
- Posts: 2
- Joined: 09 Jul 2009 05:39
#3
Post
by ScumPuppy » 10 Jul 2009 00:31
Jeb
thanks for the info, I will look into that
Do you know of a solution for opening the multiple office documents without having to close one before it opens the second? I would like those to load up one after another but they require me to click close on the application before it loads up the second =(
-
jeb
- Expert
- Posts: 1057
- Joined: 30 Aug 2007 08:05
- Location: Germany, Bochum
#4
Post
by jeb » 10 Jul 2009 01:45
Hi ScumPuppy,
I tried this
"%ProgramFiles%\microsoft office\office\winword" myDoc_eins.doc
"%ProgramFiles%\microsoft office\office\winword" myDoc_zwei.doc
or
"%ProgramFiles%\microsoft office\office\winword" myDoc_eins.doc myDoc_zwei.doc
Ok it opens both documents at the same time.
But I don't understand the reason, why you want to open it one after another?
You can add a "wait" between the two lines, so it would mostly worked one after another.
jeb
-
avery_larry
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
#5
Post
by avery_larry » 10 Jul 2009 11:38
If you use start without the "wait", then you can open one after the other without closing the program first. But like you found, it doesn't wait for it to fully open, either. jeb came up with good stuff. It's probably easiest if you just pick an arbitrary amount of time to wait between the commands like this:
Code: Select all
start "url1" iexplore http://some.web.page.com/index.html
ping -n 15 127.0.0.1>nul 2>nul
start "doc1" winword "c:\path\to\doc.doc"
ping -n 10 127.0.0.1>nul 2>nul
start "doc2" winword "c:\path\to\other.doc"
ping -n 4 127.0.0.1>nul 2>nul
The ping command will pause for roughly the number of seconds minus 1 from what you specify with -n. (So the first ping will wait about 9 seconds, not 10.)
Otherwise you could look at wmic and/or tasklist (which I don't use enough to help you with) if you want standard available commands to help you decide when the program is fully opened. In the case of Internet Explorer, though, I don't think there will be any way for you to determine that IE has opened AND that the page has fully loaded.