Autorefresh code

Welcome Forums General PowerShell Q&A Autorefresh code

Viewing 2 reply threads
  • Author
    Posts
    • #198620
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      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

      • This topic was modified 5 months, 2 weeks ago by joshyland67.
      • This topic was modified 5 months, 2 weeks ago by kvprasoon. Reason: code formatting
    • #198629
      Participant
      Topics: 12
      Replies: 1642
      Points: 2,660
      Helping Hand
      Rank: Community Hero

      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
      https://addons.mozilla.org/en-US/firefox/addon/tab-auto-refresh/

    • #198635
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      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 🙂

      • This reply was modified 5 months, 2 weeks ago by joshyland67.
Viewing 2 reply threads
  • The topic ‘Autorefresh code’ is closed to new replies.