Hello @OscarGong, directly from the clipboard this should not work. To replace the clipboard I use the App Yoink
With this I can cache the different file types and then forward them with AirDrop.
Could you describe a bit more what exactly you want to do with this? Are you sending it to your phone? If you are, you could use the universal clipboard.
If you are trying to share with another computer, you could probably send the clipboard to a default text file and then send that? Neither are perfect solutions, but maybe they will help?
Airdrop would be an interesting feature for KM though.
Thanks, your video is very helpful. I have already using Yoink for several years, I know this function.
But I am seeking a Keyboard Maestro native solution.
That library doesn’t work with the Clipboard; it only works with files.
Usage is not very difficult.
Drop the “Sharing Utilities.scptd” script library into this folder:
~/Library/Script Libraries/
Invoke it via AppleScript like so:
use shareLib : script "Sharing Utilities"
use scripting additions
# Must be a LIST of POSIX Paths.
set fileList to {"/Users/myUserName/Downloads/text-utilities.zip"}
begin AirDrop with fileList
I’ve asked the author of the library about making it work with the Clipboard.
That won't work, because the single listed POSIX Path in the script is arbitrary and has nothing to do with the Finder selection.
What you're looking for is something like this:
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2018/06/01 20:00
# dMod: 2018/06/02 00:12
# Appl: Finder & Sharing_Utilities_Library (by Shane Stanley)
# Task: AirDrop Selected Items in the Finder
# Libs: Sharing Utilities.scptd
# Osax: None
# Tags: @Applescript, @Script, @Finder, @AirDrop, @Selected, @Items
----------------------------------------------------------------
use shareLib : script "Sharing Utilities"
use scripting additions
----------------------------------------------------------------
# Acquire the Finder-selection as a list of aliases.
tell application "Finder"
set finderSelectionList to selection as alias list
if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
end tell
# Transform the aliases of the Finder-selection to POSIX Paths.
repeat with theFile in finderSelectionList
set contents of theFile to POSIX path of theFile
end repeat
begin AirDrop with finderSelectionList
----------------------------------------------------------------
Unfortunately I can't test this, because my 17" Mid-2010 MacBook Pro doesn't support AirDrop.
Oh. No. I did not know I had to install a script library. Now I know a little bit more about AppleScript then. I understand the error report better. Sorry for my ignorance.
For the airdrop function, I've found an alternative way in BTT. Just click the menu bar item:
It's odd I need a second identical action to make it work. But it works.