Put a File’s Path In the Clipboard

I’m not the best at writing scripts (Google is my personal assistant). However, I did manage to stumble across this script that I use quite regularly. It’s really simple and a missing part of the Mac OS. I tend to need the full path to a file on my computer.

[code]
on open (theFile)
set the clipboard to theFile as text
end open
[/code]

You can copy and paste the code above or just for fun, click this link to open the Script Editor with the code ready to go. All you have to do is save it with these settings:

1. File > Save As…

2. Set the File Format drop down menu to “Application”

3. Check the “Run Only” checkbox

4. Navigate to your ~/Library/Scripts folder (create it if it doesn’t exist) and save it there

5. Run the AppleScript Utility application located here: “Applications/AppleScript/”

6. In that app’s window, check the boxes for “Show Script Menu in menu bar” and “Show Library scripts”

Now when you ever want to run this app, just mouse up to the Scripts menu and you should be able to find your new application.

Conversely, you can also simply save your new AppleScript wherever you want and then drag it to the toolbar of any open Finder window so it’s nearby. I never did that because the script won’t work when you’re trying to use it on an item located on the desktop. So, just put it in the global script menu and you’re done. Now when you want the path to an item, just click it so it’s highlighted (you don’t have to open the file) and then run your app from the Script Menu.