7 Replies Latest reply: Jan 6, 2014 3:45 AM by Mr. Latte
Mr. Latte Level 1 Level 1 (5 points)

I want to write an AppleScript to achive a simple task. That is, I open a Safari window on Desktop 1 and automatically reload every 30 minutes while I do my dialy work on desktop 2.


Here is my script:


tell application "Safari"


    tell application "System Events"

        tell process "Safari"

            keystroke "r" using {command down}

        end tell

    end tell

end tell


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.


Is there any way to just let Safari to reload in the background without bring Safari window to foreground on Desktop 1?


I have done a coumple of researches; many of them say I should not use "activate" in my script. I tried that but then the script will just do nothing.

Mac OS X (10.7.3), iMac, MacBook Pro, Mac Pro, iPhone, iPad, and more