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.*)
return do shell script "python -c \"import urllib, sys; print (urllib.quote(sys.argv))\" " & quoted form of thepath
tell application "Finder"
set sel to the selection as text
set the clipboard to "file://localhost" & my path2url(POSIX path of sel)
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:
Thanks, that’s very helpful.