Advertisement
Guest User

Browser Loader

a guest
Jun 25th, 2015
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on open location the_url
  2.     tell application "System Events"
  3.         set the_apps to the name of every process whose visible is true
  4.         set browser_apps to {"Google Chrome", "FirefoxDeveloperEdition", "Safari"}
  5.         repeat with the_app in browser_apps
  6.             if the_app is in the_apps then
  7.                 my openURL(the_url, the_app)
  8.                 return
  9.             end if
  10.         end repeat
  11.         my openURL(the_url, item 1 of browser_apps)
  12.     end tell
  13. end open location
  14.  
  15. on openURL(the_url, the_app)
  16.     tell application the_app
  17.         open location the_url
  18.         activate
  19.     end tell
  20. end openURL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement