I don't understand the meaning and use of the term flavors as in PastClipboardFlavors, SystemClipboardFlavors

I read the KM Wiki and still don't understand.
thanks in advance for your time and help

2 Likes

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% ):

  1. com.adobe.pdf
  2. com.apple.traditional-mac-plain-text
  3. com.apple.webarchive
  4. com.microsoft.appbundleid
  5. com.microsoft.DSP-Text
  6. com.microsoft.Embed-Source
  7. com.microsoft.Link
  8. com.microsoft.Link-Source-Descriptor
  9. com.microsoft.Object-Descriptor
  10. public.html
  11. public.png
  12. public.rtf
  13. public.tiff
  14. public.utf16-external-plain-text
  15. public.utf16-plain-text
  16. 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):

image

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:
image

Then, when I paste it again into WhatsApp, I get this cleaner result:
image

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.

14 Likes

excellent crystal clear didactic explanation. thank you very much.
I created a macro just to make sure I understand.

2 Likes

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.

3 Likes

great macro ! thank you very much ! You are very smart !

1 Like

Such great answer. I’ve used KM for years and years and didn’t know about this. Thanks @JuanWayri!

2 Likes

@JuanWayri has a talent for formulating clear and didactic explanations.

2 Likes

Hello @rdr :wave:

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 :de:

Tobias

2 Likes

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

1 Like

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:

3 Likes

wow

thanks for this detailed and extensive explanation

thank you very much for all these references.