Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto reload script 1

Status
Not open for further replies.

neutec

Technical User
Apr 26, 2003
343
Hello everyone,
Im looking for a script or maybe a program that will cycle through a list of URL's to be viewed on a web browser. For example I wanted to use a web browser to display local news headlines and automatically change by a pre determined set time to another web page. Ive seen this done before but I cant find a script that can do this. Does anyone know of such a script that I can use for this?
 
Do a search for InternetExplorer.Application

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Ive looked for hours and cant seem to find what Im looking for. Do yo know of any example scripts that would work?
 
I'm guessing you didn't look very hard. ;-)

As dm4ever suggested, you can use InternetExplorer.Application to navigate to a URL.

From there it just takes a little creativity to create a loop of URLs.

I've set this example to stop working after 11PM since I don't like coding infinite loops.

Code:
'====================================================
'
' NAME: IERotator.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 5/29/2008
' COPYRIGHT (c) 2007 All Rights Reserved
'
' COMMENT: Auto navigates IE through a list of URLs
'
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS 
'    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'
'=====================================================
Dim IE, URLArray, URL
Set IE = CreateObject("InternetExplorer.Application")

URLArray = Array("[URL unfurl="true"]http://www.msn.com","http://www.thespidersparlor.com/[/URL]
vbscript","[URL unfurl="true"]http://www.cnn.com")[/URL]

Do While KeepGoing = True
	'Prevent an infinite loop, shut down script at 11:00
	If Hour(Time)= 23 Then KeepGoing = False
	For Each URL In URLArray
		IE.Navigate2 URL
		IE.Visible = True
		'Wait for 1 minute
		'1 Second = 1000 milliseconds therefore 60 seconds = 60000
		WScript.Sleep 60000
	Next
Loop

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thannks for the help. I appreciate you time in writing the script. I wasnt sure how to write the script as Im very new to Vbscript. I took you code about and saved it into a .vbs file but when I double click the file nothing happens. Any idea on what Im doing wrong or missing?
 
Just add the line KeepGoing = True at the top of the program.
David.
 
Thanks for following up on that David. I added that Do While just before posting and had not tested that part.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thanks guys for your help, its working great. How hard would it be to add a text files that contained all of the websites that the script should scroll through or is thast not possible?

Thanks again for your help.
 
It is easy. Refer to my FAQ for that code. faq329-4871

Use the same code for reading the WSLIST.TXT file into an array.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
How does this look? Do I just need a wslist.txt file now?

Code:
KeepGoing = True
Dim IE, URLArray, URL
Set IE = CreateObject("InternetExplorer.Application")
On Error Resume Next

'open the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
set WSHShell = wscript.createObject("wscript.shell")
'open the data file
Set oTextStream = oFSO.OpenTextFile("wslist.txt")
'make an array from the data file
RemotePC = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close

URLArray = Array("[URL unfurl="true"]http://sports.espn.go.com/nba/index",[/URL]
"[URL unfurl="true"]http://www.nytimes.com","http://www.cnn.com",[/URL]
"[URL unfurl="true"]http://news.yahoo.com",[/URL]
"[URL unfurl="true"]http://www.foxnews.com/us/index.html")[/URL]

Do While KeepGoing = True
    'Prevent an infinite loop, shut down script at 11:00
    If Hour(Time)= 23 Then KeepGoing = False
    For Each URL In URLArray
        IE.Navigate2 URL
        IE.Visible = True
        'Wait for 1 minute
        '1 Second = 1000 milliseconds therefore 60 seconds = 60000
        WScript.Sleep 30000
    Next
Loop
 
Change this:
RemotePC = Split(oTextStream.ReadAll, vbNewLine)

To this:
URLArray = Split(oTextStream.ReadAll, vbNewLine)

Then delete this:
URLArray = Array(""""
And add back in the header information. It makes me very sad when people drop giving credit where due.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Yes, you can maximize it and also can control if you want menus etc. Here is an example.

Note that the FULLSCREEN mode is what you get when you press F11. I don't think that is what you want but maybe it is. The following example will give you an end result of a maximized screen. Read my comments to understand the what and why of the code.

Code:
page = "[URL unfurl="true"]http://www.thespidersparlor.com/vbscript"[/URL] 
Set IE = CreateObject("InternetExplorer.Application")
[green]'First hide IE[/green]
IE.Visible = False
[green]'Position the window to top left.[/green]
IE.Top = 0
IE.Left = 0
[green]'Use full screen to determine maximum width & height[/green]
IE.FullScreen = True
W = IE.Width
H = IE.Height
[green]'Now go out of full screen and set the height and width to our maximum sizes.[/green]
IE.FullScreen = False
IE.Width = W
IE.Height = H
[green]'Control our menu bars etc.[/green]
IE.AddressBar = False
IE.MenuBar = False
IE.StatusBar = True
IE.ToolBar = False
[green]'Finally we show IE and navigate to the page.[/green]
IE.Visible = True
IE.Navigate page

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Markdmac,
I was actually trying to expand the video player within IE to go full screen. If you click on the link You will see a video player. In the lower right corner of the player there is a full screen button. I would like the script to expand the video full screen automactically. Can a VBscript do this?
 
I am unaware of any way for vbscript to control flash objects.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
neutec-

It would be good if you put this line in back at the top of the program:

' Portions Copyright (c) 2008, Mark D. MacLachlan , The Spider's Parlor, all rights reserved.

He certainly deserves it.

Regards,
David.
 
I really appreciate everyones help and will be sure to add that informastion to the header.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top