Can't Remove Styles From Clipboard Text

I have a macro designed to remove all styles from the text on the system clipboard. I have used both of the techniques shown below, and they seem to work nearly identically, but I've found some situations where I copy white colored text, run the macro, then paste it and the color is still set to white as opposed to just plain text (which would paste as black).

I have solved my problem by using the GetPlainText utility but I'm super curious why this doesn't work in KM in all cases. Anybody help?

Try the Apply Style action:

https://wiki.keyboardmaestro.com/action/Apply_Style_to_Clipboard

Can you tell us exactly what those situations are so we can have a look ourselves?

1 Like

I would just do this:

  1. Set a KM Variable to the Clipboard -- this is plain text only
  2. Set the Clipboard to that variable.

Hey @mtrifiro,

I would rate this as a bug, but you'll have to provide a proper test-case exhibiting the problem before it's worth taking to Peter.

-Chris

I'm not sure how to send you contents from my clipboard that break KM.

Reach @peternlewis

Without context it is hard to know what is going on.

The clipboard, after either of those operations, has only unstyled plain text entries.

Likely issues:

  • Clipboard Caching by the target application
  • Paste matching the existing style. Technically, when displayed, there is no such thing as plain text, since the text displayed always has some style, and when you paste unstyled plain text it will typically adopt the style of the character that was before it which can be the character that was deleted and no longer exists, since the Mac text system is smart enough to remember what the style at the insertion point is, even if the characters have been deleted.

As for why GetPlainText behaves different, I have no idea since I don't know what it does. Maybe it activates (thwarting clipboard caching) or maybe it actively styles the text in a plain way.