Solved

Script to Auto Refresh IE7 with multiple Tabs open

Posted on 2010-11-16
4
2,314 Views
Last Modified: 2012-05-10
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
Comment
Question by:CSTAR05
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
asurianu earned 125 total points
ID: 34289787
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
 
LVL 14

Expert Comment

by:Psy053
ID: 34496775
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
 
LVL 14

Expert Comment

by:Psy053
ID: 34497109
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
 
LVL 3

Expert Comment

by:sam0x01
ID: 34969907
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now