Browse the docs

Clipboard holds

Passes when the clipboard holds a given type of content, such as text, an image, a file or a URL.

The clipboard holds type

Keyboard Maestro: Clipboard (Has Type, Does Not Have Type)

Details #

Checks which types the first item on the clipboard offers and passes when type is one of them. Types are the system's identifiers, compared ignoring case. Common ones:

  • public.utf8-plain-text: plain text.

  • public.png, public.tiff, public.jpeg: images.

  • public.file-url: files copied in Finder.

  • public.url: a web address.

  • public.rtf, public.html, com.adobe.pdf: rich text, HTML, PDF.

The trace shows the type you asked for and every type the clipboard offered (types), which is the easiest way to find an identifier: copy the thing, run the macro and read the trace. Reading the clipboard's types is harmless, so it happens for real in a dry run too.

Every condition accepts "negate": true, which flips the verdict. The trace records what was compared before the flip, so a negated condition that blocks a macro still shows the real values.

Conditions in an Only if list combine with all: every one must pass, and an empty list always passes. An if step or a repeat loop takes a match of all (default) or any.

Parameters #

ParameterTypeRequiredValuesWhat it does
typetextYesThe type identifier to look for, for example public.png. Several, separated by commas (public.html, public.rtf), match when the clipboard has any of them. Left empty, nothing matches.

Examples #

Is an image on the clipboard
Do
  1. If the clipboard holds public.png
  2. Show “The clipboard has a PNG”
  3. Else
  4. Show “No PNG on the clipboard”
Open in Switchboard to try it

Gotchas #

  • The match is exact, not by family: a screenshot may offer public.png and public.tiff but not public.jpeg.

  • Only the first clipboard item is checked.

  • To test the text itself, use Clipboard matches or Compare text with {{clipboard}}.

See also #