Click to See Complete Forum and Search --> : VB script to refersh any open browser
SKSM
April 3rd, 2008, 02:56 AM
Hi ,
I need a info on how to refresh any open browser using Vbscript.
I tried this but it does not wrk.
set IE = CreateObject("InternetExplorer.Application")
IE.Refresh = true
Thanks in advance
saif
olivthill
April 3rd, 2008, 06:51 AM
Try:Set objShell = WScript.CreateObject("WScript.Shell" )
Do
' Set the focus to the browser whose name starts with "Codeguru"
objShell.AppActivate "Codeguru"
' Send the F5 key for a refresh
objShell.SendKeys "{F5}"
iRetVal = objShell.Popup("Stop refreshing script?", 3, "", 4)
If (iRetVal = 6) Then
Exit Do
End If
'Wait for 5 seconds
Wscript.Sleep 5000
LoopLook for the name of your application in the list of applications (by pressing ctrl alt del). On my computer, instead of having something like "Internet Explorer", I have the title of the current HTML page.
The messagebox asking for the interrupion is not very convenient. Maybe there is a better solution.
PeejAvery
April 3rd, 2008, 07:04 AM
In order to refresh every open browser window, you would have to populate all window handles to see if they are instances of Internet Explorer or not. VBScript cannot do this. If you picked up VB.NET Express, you could write this in just a few minutes. This way you could use API to grab all the open window instances.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.