Solved

Script to Auto Refresh IE7 with multiple Tabs open

Posted on 2010-11-16
4
2,335 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Bada platform is becoming more and more famous this days and people talking about same. Some friends included those who have bada OS mobile asked me "what is bada?"and "what its features?". That encouraged me to research and write this article. [st…
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
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.

864 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

24 Experts available now in Live!

Get 1:1 Help Now