Clipboard has an image (operation of this condition)

I don't understand the operation of the "has (does not have) an image" operation. I selected and then copied a portion of a web page that has text and an image.

Upon testing the system clipboard condition, "has an image" returned false.
Testing "does not have an image" returned true.

Obviously, the clipboard does have an image. I tested this by pasting the text and image into a TextEdit file.

Could someone explain what I'm misunderstanding about the "has image" clipboard condition? Thanks.

has image is talking about whether there is an image flavor in the clipboard.

Every time you copy something, the clipboard is made up a a variety of different representations of the data copied, called “flavours”. For example, when you copy part of your web page, you will have multiple flavours:

  • plain text
  • UTF8 plain text
  • UTF16 plain text
  • rich text (RTF or RTFD or both)
  • custom web pasteboard flavour

and probably several more.

has image is referring to whether one of those flavors is an image (eg jpeg, png, etc) - that is, something you could paste into an image editor.

It is not referring to whether the rich text might have an image within it.

Thanks for the clarification. Is it possible to test the whole of a copied selection for the inclusion of an image, that is, anything beyond text?

Here is my goal: To save the clipboard contents into the simplest file format required. If an image is included, I might use an RFTD file, where if there is only text, I would use an RTF file.

Why not keep it simple and just always use RFTD files?
What is the advantage of using RTF when it doesn't have an image?

I sync a lot of my documents to my iPhone. I think iOS can display RTF documents but not RTFD.

None that I know of.

In that case I would suggest a different approach.
Save the clipboard as either:

  1. Evernote Note
    • Very easy to do, just press hotkey to create Note from Clipboard
    • Or maybe better, use the EN Web Clipper
  2. PDF
    • If the clipboard is coming from a web page, I'd just select the section of the page I want (text and images), and print to PDF.
    • If you want to create PDF from clipboard, I'm sure there are several tools that will do that.
    • You could even create a PDF and store it in an EN Note.

If you happen to have DEVONthink installed (or maybe even DEVONnote but I'm not sure) you can do that "out of the box":

1 Select a portion of a webpage (that may or may not include images)
2 Press the shortcut to save the selected material as RTF(D) in the database (the shortcut is ⇧⌘) by default).
3 The selected material is automatically saved as RTFD if it contains images or RTF if it's only text.

Notice that I'm not advocating the purchase of DEVONthink for the OP usage case only; simply adding a piece of info in case it is useful to some forum fellows.

You can detect what flavors the clipboard has using the Clipboard condition, conforms to com.apple.flat-rtd.

Safari includes this if the copied selection includes an image, and not otherwise. It is possible your target application behaves similarly.

If Then Else.kmactions (760 B)