Monday, May 2, 2011

AppleScript to open a collection of Safari tabs

Here's a simple AppleScript that replaces the current Safari window with a collection of tabs, each open to a different URL. I've seen several scripts that attempt to do something similar, but this one improves on them in a couple of ways:
  • It closes all of the old tabs, rather than just adding new ones.
  • It opens the new tabs directly in AppleScript, which is much faster than using system events.
The URLs in the script are just an example; obviously you'll want to replace them with others.
 tell application "Safari"   activate   -- close all but one tab of the front window   try     repeat       close tab 2 of window 1     end repeat   end try   -- open the URLs in separate tabs   tell window 1     set URL of tab 1 to "http://weather.yahoo.com/forecast/USMD0100.html"     ma ...


Add to digg Add to Reddit Add to Slashdot Email this Article Add to StumbleUpon

Source: http://feeds.macosxhints.com/click.phdo?i=71d6b65e02d5814f1a0b37d4d3a5761c

mac app store macworld apple technology news microsoft app store

No comments:

Post a Comment