Web Dev Notes

Blog about web development by Robert Dawson

Automator script to copy all open URLs in Safari to clipboard


You need to send someone (or do anything with) a list of URLs you have open (in Safari or Chrome on Mac).


Use this Automator workflow script:

on run {input, parameters}
	set _urls to {}
	tell application "Safari"
		repeat with _tab in tabs of window 1
			set end of _urls to URL of _tab
		end repeat
	end tell
	set {_tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
	set the clipboard to _urls as string
	set AppleScript's text item delimiters to _tid
	return input
end run

Then, just paste wherever you like!

Open selected text in TextMate with Automator

Like most developers with a Mac I presume, I love TextMate! One of the things I have often wanted to do is to select text in an application and paste it into TextMate. Thanks to Aaron at 9thport.net, here is a dead-simple solution!


  1. Open Automator.
  2. Make a new Service script.
  3. Add Run Shell Script.
  4. Write "cat | mate" and save as "Launch TextMate".
  5. Open System Preferences.
  6. Go to Keyboard > Services.
  7. Check Launch TextMate and give it a shortcut, like F6.
  8. Go to an application with text, select it, and hit F6!


Automator workflow to download specific files from URL

I've finally returned to the saving grace of Macs after over a decade and I love it! One useful app is Automator, which, as the name implies, automates tasks. This is potentially very helpful, although, after looking at all the options one night, I have to confess that I walked away wondering how I would practically use it.

Well, today, at a conference, I finally found a great use: downloading specific files, in my case .pdf and .zip files, from a URL.


  1. Open Automator.
  2. Make a new workflow.
  3. Add these actions, in this order:
    1. Get Specific URLs
    2. Get Link URLs from Webpages
    3. FIlter URLs
  4. In the "Get Specific URLs" action, set your URL.
  5. In the "FIlter URLs" action, add your filter(s). (e.g., Name contains .pdf)
  6. Run, to test results.
  7. Add the "Download URLs" action and choose a download folder.

Wait for it to finish, which could take a while depending on total file size.