Erg....
I know there is an action to use to clear any text formatting of the text in a variable or a clipboard before I paste some text and I cannot find it!
Cheers
It depends on what you are copying from (which application is placing items in the pasteboard)
but the typical pattern is that the pasteboard will contain both formatted (rtf and or html) pasteboard items, and a plain text pasteboard item or two.
The trick then is to
- Look up clipboard "flavors" in the KM wiki,
- check which flavours are in the clipboard with the
%SystemClipboardFlavors%
token, - delete the flavours that you don't want (action:Remove Clipboard Flavors [Keyboard Maestro Wiki]), and
- paste.
The only flavour you want to keep will typically be:
public.utf8-plain-text
Most excellent, and thank you for the flavour to keep, priceless!
Just to point out that Variables are just text - they do not hold any formatting so no need to clear any formatting once the text is stored in a Variable.
So, simply making a Variable from any text in a Clipboard will also clear the formatting if you then use that Variable to do something.
And the same is true of KM Tokens. The Token %SystemClipboard% is any text that is in the Clipboard without any formatting.
The simplest way to paste the Clipboard as Plain text with Keyboard Maestro is to Insert text by Pasting
using %SystemClipboard% as the text to paste.
@Zabobon I know it's not proper etiquette to reply in this fashion and we are to simply +1 the heart.
But...
Thank you for the excellent info, very helpful!
So if I use a lot of different clipboards that are text (too late in the game I realize I should have made them variables - but I didn't and the mechanism is very built into my workflow)
The best way to paste unformatted text might be to set the system clipboard to that Clipboard and then paste the SystemClipboard?
I also just 'saw' duh... that when I make the Clipboards, I should make them as plain text, not styled text. If I do that, then when I paste the Clipboard xx, it will match the style that I am pasting into. yes?
Cheers
Direct clipboard to clipboard:
...will retain formatting (that's what it's for).
But you can go via a token as @Zabobon described above:
Or, to paste unformatted text directly from the Named Clipboard "Test":
@Nige_S has just answered this perfectly. To paste the text as unformatted text just insert text by pasting
and use either a Variable or a Token - the pasted text will match the text you are pasting into as all Variables and all Tokens have no formatting themselves.
%SystemClipboard%
%NamedClipboard%Test%
%Variable%Local_Something%
as long as you are using any Token or Variable no need to get rid of formatting as there won't be any formatting.
So, there is no problem with you not initially making your Named Clipboards as plain text.