Is it possible to automate/add a shortcut to getting a link to an iCloud file in macOS finder?

I know that I can get a link by right-clicking on a file in my iCloud Drive in macOS finder, then selecting Share -> Add People -> Copy Link -> Share Options -> Anyone With The Link.

If possible, I’d like a faster way to do it. For example, through an applescript or a keyboard shortcut.

Keyboard Maestro would probably make short work of that. Probably Better Touch Tool would, as well.

Not quite the same but I found an applescript that converts the macOS file path to a URL scheme and copies it to your clipboard. I then added it to Automator as a service so that I can call it with a keyboard shortcut in Finder. Limitations: The link generated from this script will not work on any device except for the device that created it. But perhaps you can modify it to your needs. Here’s the script:

(* To use this script, select a file or folder in Finder, then run this script. This script will get the file path, convert it to a URL and save it to your CLIPBOARD.*)

(*LIMITATIONS: This script does not appear to work with files outside of FINDER.*)

on path2url(thepath)
	return do shell script "python -c \"import urllib, sys; print (urllib.quote(sys.argv[1]))\" " & quoted form of thepath
end path2url

tell application "Finder"
	set sel to the selection as text
	set the clipboard to "file://localhost" & my path2url(POSIX path of sel)
end tell

Would you be able to explain how? Not too familiar with these applications. Thank you.

Thank you, but unfortunately looking specifically for the iCloud link.

Hello @BluesyMarlin, unfortunately I have no script for you. I created a workflow from BetterTouchTool (sharing via context menu) and actions with Keyboard Maestro. So similar to the suggestion of @Martin_Packer.

Here is an example:

2020_07_06_Support_1

1 Like

Thanks, that’s very helpful.

1 Like