title: AppleScript: How to reload a Safari window without bring the window to the foreground while I am in other Desktop space
body: <p>I want to write an AppleScript to achieve a simple task. That is, I open a Safari window on Desktop 1 and automatically reload the browser every 30 minutes while I do my daily work on Desktop 2.</p>
  
  <p>Here is my script:</p>
  
  <pre><code>tell application "Safari"
      activate
      tell application "System Events"
          tell process "Safari"
              keystroke "r" using {command down}
          end tell
      end tell
  end tell
  </code></pre>
  
  <p>This script works. However, whenever the script is executed, my current Desktop 2 will be brought back to Desktop 1. It is distracting to my workflow.</p>
  
  <p>Is there any way to just let Safari to reload in the background without bring Safari window to foreground on Desktop 1?</p>
  
  <p>I have done a couple of searches; many of them say I should not use "activate" in my script. I tried that but then the script will just do nothing.</p>