Page 1 of 1
Im trying to batch multiple web pages & office documents
Posted: 09 Jul 2009 05:44
by ScumPuppy
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
Posted: 09 Jul 2009 07:40
by jeb
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
Posted: 10 Jul 2009 00:31
by ScumPuppy
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 =(
Posted: 10 Jul 2009 01:45
by jeb
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
Posted: 10 Jul 2009 11:38
by avery_larry
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.
hello
Posted: 17 Jul 2009 04:55
by RobJohnB95
im not sure about the documants but opening three url's in one browser in differant tabs is very easily done.
start
www.siteone.com www.site2.com www.site3.co.uk
there mus be a space between each url and www. must be at the beginning so google.com wouldnt work for e.g
www.google.com would