Adrian Nier Code

Back to overview

Visit pages for essential freeware

Last modification: Wednesday, January 20, 2010 08:07 pm

Opens a new Safari window and loads the pages for essential software for Mac OS X.

Implementation

on run
   
   set _urls to {}
   
   -- Players
   set end of _urls to "videolan.org" -- VLC
   set end of _urls to "perian.org" -- Perian
   set end of _urls to "www.real.com/offer/mac/realplayer" -- RealPlayer
   set end of _urls to "dynamic.telestream.net/downloads/download-flip4macwmv.htm" -- WMV Components
   set end of _urls to "get.adobe.com/flashplayer" -- Flash
   
   -- Browsers
   set end of _urls to "cyberduck.ch" -- Cyberduck
   set end of _urls to "firefox.com" -- Firefox
   set end of _urls to "earth.google.com/intl/en/download-earth.html" -- Google Earth

      
   -- Applications
   set end of _urls to "bombich.com" -- Carbon Copy Cloner
   set end of _urls to "get.adobe.com/reader" -- Adobe Reader
   
   -- Create the Safari window
   newSafariWindowWithURLs(_urls)
   tell app "Safari" to activate
   
end run

on newSafariWindowWithURLs(_urls)
   
   repeat with _i from 1 to count of _urls
      set _url to item _i of _urls
      
      if _i is 1 then
         set _window to newSafariWindowWithURL(_url)
         if _window is false then return false
      else
         newSafariTabWithURL_inWindow(_url, _window)
      end if
      
   end repeat
   
end newSafariWindowWithURLs

on newSafariWindowWithURL(_url)
   try
      if _url does not contain "://" then
         set _url to "http://" & _url as string
      end if
      tell application "Safari"
         make new document with properties {URL:_url}
         return window 1
      end tell
   on error _eMsg number _eNum
      return false
   end try
end newSafariWindowWithURL

on newSafariTabWithURL_inWindow(_url, _window)
   try
      if _url does not contain "://" then
         set _url to "http://" & _url as string
      end if
      tell application "Safari"
         tell _window
            make new tab with properties {URL:_url}
         end tell
      end tell
   on error _eMsg number _eNum
      return false
   end try
end newSafariTabWithURL_inWindow