• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2592
  • Last Modified:

Script to Auto Refresh IE7 with multiple Tabs open

SITUATION:

I have several WYSE thin clients accessing a proficy historian server that runs reports (Via a web interface)....On the Clients, I have several pages that load in different tabs, in which i currently have a script that runs to send "CNTRL+TAB" keys to toggle thrrough the tabs in IE7.

MY PROBLEM
My problem is, often the pages expire or for some reason, display errors in which hitting "F5" to refresh the page, fixes the problem....is there a VBS script I can stick in the "startup" folder to kick off (along with the IE page that loads all of the tabs) to ensure every 2 minutes that the page can be automatically refreshed? I've used one already, but only seems to work with just 1 page. Guess I just need scripting help here. Thanks!!

ULTIMATE GOAL:
Here's the script I have ..but need to work it so I can include other "tabs" within the same IE7 page:  (script from: http://blogs.technet.com/b/heyscriptingguy/archive/2005/09/27/how-can-i-periodically-refresh-a-web-page.aspx )




On Error Resume Next
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "http://www.microsoft.com/technet/scriptcenter"   
objExplorer.Visible = 1
Wscript.Sleep 5000
Set objDoc = objExplorer.Document
Do While True
    Wscript.Sleep 30000
    objDoc.Location.Reload(True)
    If Err <> 0 Then
        Wscript.Quit
    End If
Loop


Thanks in Advance!!!
0
CSTAR05
Asked:
CSTAR05
  • 2
1 Solution
 
asurianuCommented:
Hi
instead of that you can make it such a way that web pages automatically refresh after certain time.
Here is a EE discussion thread on the same
http://www.experts-exchange.com/Web_Development/Miscellaneous/Q_20860398.html
0
 
Psy053Commented:
You've mentioned that you have a script that changes the tabs using SendKeys, why don't you modify that script so that it also sends F5
0
 
Psy053Commented:
I thought I would write up an example for you that should do most things you are after.

The attached VBScript will open up three tabs and then cycle through them (using SendKeys to send CTRL TAB), once the script has cycled through the tabs a pre-determined number of times, the script will then refresh each tab (using SendKeys to send F5), the script will then loop through the Cycle and Reload sections.

There are some settings you can change with the script, these are at the top and are commented.
 
One thing to be aware of though, is that if the Focus is removed or stolen from the Internet Explorer window, the Script will cease to function correctly - however, the SendKeys events will continue to be sent to whatever has focus. I will have a look around and see if I can find a fix for this, however, to my knowledge, there isn't a way to detect whether Internet Explorer still has focus or not.

In order to stop the Script, you will need to close the Internet Explorer window that the Script opened.

Cycle-And-Reload.txt
0
 
sam0x01Commented:
Looks like the object model of Internet Explorer through vbScript does not handle Tabs other than through SendKeys. This sample above will not be transparent to the user, it will toggle the tabs and refresh the page on each tab. It may be possible through the .NET Framework which could be accessed through Powershell (just not vbScript).
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now