here’s a handy trick based on an original post you can find here at Macworld.
There may be times—such as when you’re trying to convey to someone where a file can be found on their machine, or maybe when you’re writing an OS X hints column—when you need to put the path to some file or folder into another document. — Rob Griffiths, Macworld.com
the original script does something very simple — a basic task which is missing from OS X — copying the filepath of a selected finder item into a text format. the original script looks like this :
running this script will place text on your clipboard — ready to paste into an email or whatever. the text would look something like this :
this shows that ‘Script Editor’ can be found in the folder ‘Applescript’ which is in the folder ‘Applications’ — a slash delimited filepath.
you may prefer the more common colon delimited filepath which also shows the home volume — MacGrunt:Applications:AppleScript:Script Editor.app
if so, you’d replace those two lines in the middle with this :
set the clipboard to the selection as text
but here’s another variation which does two additional things :
• allows for copying filepaths for multiple items
• changes the output to an arrow delimited format
results look more like this :
MacGrunt > Applications > AppleScript > Script Editor.app
MacGrunt > Users > macgrunt > Desktop > Picture 1.png
you can download CopyPath as a finished script here.
now for the cool bit …
having to launch an app every time you want to copy a filepath would be a right pain. but you can turn this script into a contextual menu item with automator. here’s how.
slightly different for OS X 10.6 (Snow Leopard) :
automator changed in 10.6 to include the ‘Service’ option. using this option you’ll see the top of the workspace looks more like this (click to enlarge) :
set the service to allow input from files and folders in the finder.
and for Lion users … :
you guys are so advanced, you’re sure to work it out yourselves.
you’re bound to find many other uses for this handy feature of automator.