Thursday, January 01, 2009

Copy paths of selected items in Mac OS X Finder to clipboard


This script sets the clipboard to the paths of items selected in Finder window.
If there is no selection the clipboard is set to the path of the target
of the Finder window.


1. Paste this script in Script editor
2. Save it as an application - ~/scripts/finder/
3. Drag and drop onto the Finder widow toolbar.

@author Sandip V. Chitale
@version 1.0
@date 1/1/2009
tell application "Finder"
set paths to ""
set selected to selection
if (count of selected) is 0 then
set paths to POSIX path of (target of front window as alias)
repeat with aPath in every item in selected
set aPathString to POSIX path of (aPath as alias)
if paths is "" then
set paths to aPathString
set paths to paths & "
" & aPathString
end if
end repeat
end if
if paths is not "" then
set the clipboard to paths as text
end if
end tell

No comments: