Copy Safari URLs with Applescript

I normally use Chrome (still do for web development), but read recently about how Safari is faster. I decided to try using Safari as my main browser for normal web browsing. One downside was my plugin for copying all tab URLs to my clipboard was not available in Safari.

Fortunately I learned enough Applescript to write a short script to do it for me:

tell application "Safari"
  set the_URLs to ""
    repeat with this_tab in tabs of window 1
        set the_URLs to the_URLs & URL of this_tab & return
    end repeat
end tell
set the clipboard to the_URLs

Sometime in the future I plan on hooking this up to an Alfred workflow to more easily trigger it.