Question Locked

Bat File

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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 www.google.com

start iexplore www.hotmail.com

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

9 replies

by Member 25348569

Powershell:
$ie = new-object -com internetexplorer.application
$ie.visible = $true
$ie.navigate2("www.google.com")
$ie.navigate2("www.hotmail.com",2048)

vbscript:
Set oIE = CreateObject("internetexplorer.application")
oIE.visible = True
oIE.navigate2 "www.google.com"
oIE.navigate2 "www.hotmail.com",2048

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

by Member 25348569

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!

:D

by wizard-09

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 :)

by Member 25348569

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?

by wizard-09

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 ?

Thomas

by Member 25348569

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

Sorry!

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

by Member 25348569

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
Next

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 "www.google.com"
oIE.navigate2 "www.hotmail.com",2048

by wizard-09

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

This discussion is closed to new replies.