Autorefresh code

Hi all,
am trying to create a powershell Script to auto refresh some or all open pages in Google chrome and others in Firefox.
This one only refresh 1 active page for only 1 Navigateur:

while(1) { # Loop forever
sleep -Seconds 3 #1 hour
$wshell = New-Object -ComObject wscript.shell
if($wshell.AppActivate('Chrome')) { # Switch to Chrome
Sleep 1 # Wait for Chrome to "activate"
$wshell.SendKeys('{F5}') # Send F5 (Refresh)
} else { break; } # Chrome not open, exit the loop
}

Thanks for the help

Would not recommend solutions using AppActivate and SendKeys, especially if anyone can interact with the system. Have you considered a browser add-on that is built to refresh at the interval required:

https://chrome.google.com/webstore/detail/auto-refresh/ifooldnmmcmlbdennkpdnlnbgbmfalko?hl=en

Hi Rod, thanks for the quick reply

Yes i did try them but the PC need to restart for updates 1 or 2 times a week and will have to activate the extension everytime.

No one have acces to this PC besides when i need to manually change some links.

 

Thank you :slight_smile: