Web Dev Notes

Blog about web development by Robert Dawson

Automator script to copy all open URLs in Safari to clipboard

Problem

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

Solution

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!