Bat File

By Wizard-09 ·
Hello All need to get a bat file for opening internet pages but only opening one internet page then the rest in tabs within that page.

@echo off

start iexplore

start iexplore

So I want the two above pages to open in one internet page tab anyone an ideas thanks :)

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

I'd recommend powershell or vbscript to do that

by neilb@uk In reply to Bat File

$ie = new-object -com internetexplorer.application
$ie.visible = $true

Set oIE = CreateObject("internetexplorer.application")
oIE.visible = True
oIE.navigate2 ""
oIE.navigate2 "",2048

The 2048 is the navOpenInNewTab flag so to open more tabs, just repeat the second navigate line for the new URL.

Collapse -

I just noticed a weird bug (fixed)

by neilb@uk In reply to I'd recommend powershell ...

The navigate method worked OK in PS but not in vbscipt so I tries Navigate2 and that worked OK.

Hopefully you'll pick this up else I won't deserve the thumb!

Collapse -


by Wizard-09 In reply to Bat File

For the help bat files is as far as I go, couldn't see how to make the call to open in new tab thanks for the information maybe something that I may need to look into to learn in my spare time not that I have much of that these days :)

Collapse -

OK, let's finish the job

by neilb@uk In reply to Thanks

Save the four lines of the vbscript bit of my original post into a file called, say, "RunIE.vbs". Put the single line RunIE.vbs in your batch file and you're sorted.


Yes, that easy! To set the size of the IE, add the lines:

oIE.width =
oIE.height = (in pixels)

or oIE.FullScreen = True

To set the position,

oIE.left =
oIE.Top = (again, in pixels)
0,0 is tlhc

Neil :)

What's the worst that can happen?

Collapse -


by Wizard-09 In reply to OK, let's finish the job

Set it to run on full screen, but then it really did run full screen and way to get it open so I can still see the address bar and stuff so

oIE.width = ****
oIE.height = (in pixels) *****

what would be the best to put in the ***

Thanks again, any good sites where I can learn this ?


Collapse -


by neilb@uk In reply to Cheers

I never use the Fullscreen option so I never knew that it zapped the navigation bars and stuff! Well, I never use IE, either...


Something odd seems to have happened to my IE since I ran the test. Give me a little while to sort it out!

Collapse -

OK, sorted now

by neilb@uk In reply to Cheers

The FullScreen switch needs to be turned off again.

You set the size relating to your own screen so on a 640 by 480, put anything relative to those values. I've added a bit of code to check your resolution so you can run it on systems with a different config but still set IE to the full width but you can easily set the value to, say, iVert * .8 and the same for iHoriz to get an IE window of 80% of your screen.

Little bit more complicated but still only 18 lines of code.

Set oWMIService = GetObject("winmgmts:\\.\root\cimv2")

Set cItems = oWMIService.ExecQuery ("Select * From Win32_DisplayConfiguration")

For Each oItem in cItems
iHoriz = oItem.PelsWidth
iVert = oItem.PelsHeight

Set oIE = CreateObject("internetexplorer.application")
oIE.visible = True
oIE.FullScreen= False
oIE.Left = 0
oIE.Top = 0
oIE.height = iVert
oIE.width= iHoriz
oIE.navigate2 ""
oIE.navigate2 "",2048

Collapse -

You The Man Neil

by Wizard-09 In reply to OK, sorted now

Thanks that worked a treat full screen is working perfect :)

Related Discussions

Related Forums