Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Put a file's path on the clipboard via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Put a file's path on the clipboard via AppleScript
Authored by: lmn on Apr 18, '07 10:15:47AM
You can also make your own Automator plug-in (contextual menu item) that runs a script which copies the Unix paths of all items selected in the Finder. The paths are quoted for (mostly) trouble-free pasting into Terminal. For one item, this should work:

tell application "Finder" to set the clipboard to quoted form of (POSIX path of (the selection as alias))
and for multiple selected items, this script puts each item's path on the clipboard, on separate lines:

set theSel to (selection of application "Finder")
set pathList to {}
repeat with anItem in theSel
set the end of pathList to quoted form of (POSIX path of (anItem as alias))
end repeat
set savedDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to "
"
set the clipboard to pathList as string
set AppleScript's text item delimiters to savedDelimiters


[ Reply to This | # ]