How Do I Clear an App's Internal Clipboard

Yes, like @iamdannywyatt said we are unable to get that command work. The reason being that the clipboard made by Keyboard Maestro differs from the one made by Finder significantly, so that our DAWs (Ableton & Logic) seem unable to accept it as a file.

For example my above mentioned AppleScript app and Finder make the clipboard refer to the copied file like this:

"public.file-url as propertyList": "file:///Dir/file.wav",
"public.file-url as string": "file:///Dir/file.wav",
"public.file-url as data": "file:///Dir/file.wav"

On the other hand Keyboard Maestros "Set Clipboard to File Reference" makes clipboard refer to the file like this:

"public.utf8-plain-text as string": "/Dir/file.wav",
"public.utf8-plain-text as data": "/Dir/file.wav",

So if you know, or if anyone knows how to change the clipboard textual information from the get go, or how to edit it after a copy action let us know. I'm sure those methods are faster than running my AppleScript app since it does need 1 second pause before the paste action.

I tried running set the clipboard to POSIX file "/Users/noisyneil/Music/Audio Music Apps/Patches/Instrument/Glock Box Flute.patch" from Script Debugger but pasting did nothing in Logic Pro. I'm still unsure whether things have been tightened up in Logic or macOS, but whatever's changed, it seems I'm still unable to paste patches. Ah well.

In my giddy inebriation, I missed the fact that you want to pass a variable to an applet. I'm not sure how to do that... THIS might be helpful but I'm afraid I'm slightly too hungover to dive in right now.

I'll follow Dr. Danny's medical advice.

1 Like

How is that copying done ?

When I use a KM Copy action (with the Finder window in the foreground and a file selected), the clipboard created does have a well-formed public.file-url pasteboard item, containing a file:// url string like:


Is the copying to system clipboard happening through some other route – perhaps through a KM variable or something ?

...but it doesn't seem to matter the method if Logic's pasteboard has anything on it.

To add to the confusion... In Danny's case (older Logic and OS), if you clear Logic's existing pasteboard first, it does work; in my case (up-to-date), it doesn't.

and what does Local_RevealPatch contain at that point ?

  • a url-encoded path beginning with file:// ?
  • a unix path, possibly including spaces ?
  • something else ?

Ah, ok. For me the missing file:// was actually because the file path came from a variable. I've now tried to do it just purely by pointing at a file and I now get the full thing even with KB. But paste is till not working. So we can rule out the fact that it's missing file:// out.

This kind of thing:

  1. does create a well-formed public.file-url pasteboard item, but
  2. only, of course, if the path passed to it is well formed.

Here's an example:

/Users/noisyneil/Music/Audio Music Apps/Patches/Instrument/Glock Box Flute.patch

This does work on Danny's system, if Logic's pasteboard was previously empty.

I just tried to do a simplified version of my script that does only just that but the result is the same. DAW pasteboard doesn't recognize the file and paste remains unavailable.

Here's something I found out that you could try @noisneil that works for me, even with the KBs "Set Clipboard to File Reference". Before you do the set clipboard action, activate Finder, then set clipboard, then activate Logic and then do the paste keystroke. Again, not an ideal solution but it's better than "Reveal a File" since it doesn't have the flashing window.

I appreciate the thought, but I think I should clarify something about how the Logic Pro issue differs from the Ableton Live one:

The issue is not with the method of copying.

  • I'm up-to-date with both Logic and macOS, and regardless of how I copy the file or its path, pasting in Logic does not work.
  • @iamdannywyatt is on older versions of both Logic and macOS and can use the macro I gave him without issue. The caveat is that he must manually clear Logic's pasteboard at the start of the macro (Deselect all, ⌘C). He is happy with this solution for now, but is aware that when he eventually updates his system, it will break the macro.

So what we really should be trying to figure out is:

Is it Logic Pro or macOS that has latterly introduced tighter sandboxing of internal application pasteboards, and is there any workaround? I'm beginning to suspect that this might be a dead-end.

Ok, I thought that copying from Finder to Logic was something that worked for you, my bad. Anyway, I hope something breaks open and you find a way to do that. It's very strange that Logic and Finder would have a wall between them since they're both developed by Apple.

1 Like

The fact that it works when you create a standalone app might be telling. This might be a long-shot, but you could try:

tell app "Finder" to set the clipboard to "/Dir/file.wav" as «class furl»

or maybe even:

tell app "Logic" to set the clipboard to "/Dir/file.wav" as «class furl»

(or whatever the name of the app is.)

No joy with Logic, unfortunately. Thanks all the same for the suggestion.


What if you try this instead:

tell app "Logic Pro" to go "f*** itself for not working as it used to"
1 Like

Haha! I lolled at that. :rofl:

1 Like

You had a quick moment of "maybe Danny found the solution"... to quickly realizing life with Logic kinda sucks sometimes hahaha.
We still love it though. It's still an amazing DAW! :slight_smile:

1 Like

Possibly the only AppleScript joke ever conceived! :clap:t3::clap:t3:

1 Like

Haha gotta copyright that then… and create a patent around AppleScript jokes