Batch File - IE Start-up

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

Batch File - IE Start-up

Post by colmac »

I'm using a batch file to create new IE searches for location maps.
start "" https://www.google.co.uk/#q=" onclick="window.open(this.href);return false;"%search%"

start "" https://www.google.co.uk/maps/place/" onclick="window.open(this.href);return false;"%search%"

start "" http://www.bing.com/maps/default.aspx?q=" onclick="window.open(this.href);return false;"%search%"
I added the following two lines at the beginning otherwise the windows did not open in tabs. This just opens an IE window, and then waits for it to have time to open. The three windows I want then open as tabs.
start https://www.bbc.co.uk/" onclick="window.open(this.href);return false;
Timeout 2
Ideally, if IE is already open, I'd like to suppress these two lines so that an extra window is not opened. Can anyone help tell me what to do please.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Batch File - IE Start-up

Post by Rudi »

This works for me...

(Just substitute the google, yahoo and bing links for your own)
(BTW: You can substitute iexplore with chrome to open them as tabs in chrome too)
Note: Ensure the specified browser is your default browser, else it will open the first in one browser and the rest in the second browser.
The ping line is just a timer to allow foe the browser to first load

@echo off
start iexplore http://www.google.com" onclick="window.open(this.href);return false;
ping localhost -n 2 > nul
start http://www.yahoo.com" onclick="window.open(this.href);return false;
start http://www.bing.com" onclick="window.open(this.href);return false;
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

Re: Batch File - IE Start-up

Post by colmac »

Thanks for taking the time to respond, but unfortunately, the problem is still there.

Your code does exactly the same as mine.

It works exactly as I want if there is no IE window open already, BUT if there is an IE window already open, then your code opens another occurrence of IE.

I'd like for that not to happen. It is not a major problem, just a nice to have issue.

The extra code in the lines is there just to add the search location I have input earlier in the batch file

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Batch File - IE Start-up

Post by Rudi »

Maybe John Gray could provide more expert advice and support...
You'll need to wait and see if he responds.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

Re: Batch File - IE Start-up

Post by colmac »

OK No probs. Thanks anyway. I do appreciate any help given.

User avatar
John Gray
PlatinumLounger
Posts: 5411
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Batch File - IE Start-up

Post by John Gray »

You need to check whether an IE task is already started, using something like

tasklist | find /i "iexplore.exe" > nul
if %errorlevel%==0 echo IE is started so don't start a new instance


On my Windows 7 Pro 64-bit box I get TWO iexplore.exe tasks started when I start Internet Explorer, but that shouldn't matter. Take the "> nul" out temporarily to see what you get with and without Internet Explorer being started.

If you have a more complicated situation, then you'll obviously have to investigate!
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

Re: Batch File - IE Start-up

Post by colmac »

Many thanks
That works perfectly, exactly as I wanted.
Much appreciated what all you guys do for us less capable people!