I read the KM Wiki and still don't understand.
thanks in advance for your time and help
Think of clipboard "flavors" like this: when you copy something on your Mac, it doesn't just save one version of the content. Instead, it saves multiple versions, or flavors, of the same data at once.
When you go to "paste "that content, each app chooses the flavor it prefers, depending on what kind of data it expects or supports
For example, if you copy a "Table 1" in Excel for Mac:
Table 1
Column1 | Column2 |
---|---|
Cell A2 | Cell: B2 |
Cell A3 | Cell: B3 |
It would include multiple different flavor/formats of the table:
Flavors of Table 1 (obtained using %SystemClipboardFlavors%
):
- com.adobe.pdf
- com.apple.traditional-mac-plain-text
- com.apple.webarchive
- com.microsoft.appbundleid
- com.microsoft.DSP-Text
- com.microsoft.Embed-Source
- com.microsoft.Link
- com.microsoft.Link-Source-Descriptor
- com.microsoft.Object-Descriptor
- public.html
- public.png
- public.rtf
- public.tiff
- public.utf16-external-plain-text
- public.utf16-plain-text
- public.utf8-plain-tex
WhatsApp prefers image "flavors" when pasting
...and if I try to "paste" it in, lets say, WhatsApp, it will prefer the flavor that has an image ("public.png" or public.tiff):
Removing styles isn't always ideal...
If I use a macro to paste it as plain text, the result looks like this:
Column1
Column2
Cell A2
Cell: B2
Cell A3
Cell: B3
Removing unwanted flavors
In this case, I can remove the unwanted image flavors (like ("public.png" or public.tiff) with this:
Then, when I paste it again into WhatsApp, I get this cleaner result:
This is just a silly example, but there are real scenarios where the clipboard includes undesired or incompatible content. In some workflows, that can break formatting or cause performance issues.
In fact, I once helped a client significantly improve the reliability and speed of their data workflows by stripping out unnecessary Microsoft clipboard flavors that were interfering with their automation.
excellent crystal clear didactic explanation. thank you very much.
I created a macro just to make sure I understand.
Thank you for this thread @ronald, and your awesome reply @JuanWayri! Now also better understanding Clipboard Flavors I was inspired to make this macro for keeping or removing selected flavors of the System Clipboard:
List all System Clipboard Flavors- to Keep or Remove.kmmacros (5.3 KB)
(KM v11.0.4)
It lists all flavors of the current System Clipboard in a Prompt With List, accepting multiple selections, letting you keep (or, by holding ⌥, remove) selected flavors.
To minimize the risk of involuntarily removing the topmost preselected flavor, I chose to head the list with an empty line. Therefore it also asserts that this empty (hangul filler-filled) line is not the sole selection, so as not attempting to remove all flavors except this non-flavor.
great macro ! thank you very much ! You are very smart !
Such great answer. I’ve used KM for years and years and didn’t know about this. Thanks @JuanWayri!
@JuanWayri has a talent for formulating clear and didactic explanations.
Hello @rdr
This whole thing based on Clipboard Flavors are new KM features which came out with the launch of V11.
Maybe it’s possible to do this with v10 and older but then only if you’re really good at scripting.
Greetings from Germany
Tobias
In JXA, if you start the script with ObjC.import("AppKit")
, you can directly use all the NSPasteboardItem
types and methods.
Some sample code here, for example:
and
How do you know what each flavour actually does ?
You can learn a lot about the clipboard's flavour(s) by running the following shell command which contains an AppleScript command. Run this command in a terminal window after placing something in the clipboard.
osascript -e 'the clipboard as record'
You can improve on this by piping the output of this command into a "sed" action, and you can also use the KM "clipboard change" trigger to automatically display the clipboard flavours, as follows. This doesn't answer your question about what each flavour means, but it will certainly help you to observe and research what the flavours mean.
That's very easy – none of them does anything – they're just names of data formats (for MIME or file types)
Well documented, and easily searched.
Some of them are defined and named by Apple
and others by the authors of particular applications.
For mappings to typical file extensions:
wow
thanks for this detailed and extensive explanation
thank you very much for all these references.