MacOS – How to get a clickable path to a file or folder

automatorcopy/pasteemailmacospath

I already saw a lot of questions and answers about how to copy the path of a file or folder using Automator.

I personally like to use the copy option under the action menu on top of your finder because this will give you a path which can be used as a link:

Finder Screenshot

You can paste this link in your e-mail. It's clickable so the receiver can click it and the exact location of the file will be opened.

But… does anybody know if there is a way to copy this path automatically in an e-mail message using Automator?
I know how to create an e-mail in Automator but I can only copy the 'readable' path in it, which can't be clicked…

Best Answer

You might want to consider using a scripting language to do this. I've created a simple JavaScript for Automation program that can do the job (it can also be fairly easily replicated in AppleScript):

finder = Application('Finder')
finder.includeStandardAdditions = true
file = finder.chooseFile()
path = String(file).replace(' ', '%20')

You could then use the path variable to create a new OutgoingMessage in Mail.

Alternatively, you could use this as a "Run Javascript" block in Automator, then use its result in a New Mail Message (in which case you would need to append return path to then end of the script).