Clipboard history search doesn't find some text from OneNote

Keyboard Maestro clipboard history search doesn't find some items copied from OneNote...They seem to be considered graphics...but when pasted, they do come out as text. If there's text content, the search should find the text.

In this little video you can see I search for something that is in the text of the current clipboard and it doesn't find it (but if I paste in a text field, it does come out as text).

If you paste an image into a text field it comes out as text? What app are you pasting the image into? In your video you didn't illustrate this part of your situation. Maybe the app you are pasting the image into has code that converts images into text.

It may also help if you specify which version of KM and macOS you have.

I agree with you that if there's text, the search should find the text. And we see that the images are not displayed when you search for the text. So nothing's wrong there. Your video matches what my Mac does. The problem you have is that the images are being pasted as text, and you didn't show that part of your situation.

I don't have OneNote, but I'm doing my best to help without being able to replicate the problem.

It's very interesting behavior: Text is copied in OneNote, but in clipboard history switcher it seems to be an image…but if I paste into a text field (like Spotlight), it comes out as text!

I show it in this video.

FYI, unlike other Office apps, OneNote is free if anyone wants to try it (app store link).

Versions: KM (11.0.4) and MacOS (26.0.1)

I think you are entering the huge world of clipboard flavours, (which I know little about) and OneNote works hard to exploit this feature of macOS.

Any time you have anything in the clipboard, especially from strange apps like OneNote, issue this command in macOS: (don't PASTE it in, type it in, or your clipboard will change on you.)

osascript -e 'clipboard info'

I'm guessing that when you copy things in OneNote, that app makes a special effort to create different flavours of that item. And importantly, when you are viewing the clipboard history in KM, you see only one flavour of that item, the image.

In short, a clipboard item can contain multiple flavours of the same data, and when you view or paste that item, you are seeing only ONE of the flavours appear. Sometimes it's text, sometimes it's an image, sometimes it's something else.

As usual, there's only an 80% chance that I'm right, especially since I'm talking about things I don't know much about.

That’s cool. Ideally, keyword Maestro would look for a text flavor when something is on the clipboard, or at least when searching clipboards is taking place, so expected result of a search would happen…

That seems like a reasonable request, but I don't know if it's possible or easy.

It does.

It looks thru many different flavors of plain text.

My guess is that OneNote is not putting a plain text flavor on the clipboard, only the styled text.

1 Like

Perhaps you can type that command in (after pressing the copy command in OneNote) and then post the results here so we can maybe narrow in on the cause.

It may be helpful if you create this macro:

1 Like
«class HTML», 531, «class PNGf», 1467, Unicode text, 8, «class weba», 837, «class RTF », 351, «class ut16», 12, «class utf8», 4, «class 8BPS», 5872, GIF picture, 574, «class jp2 », 4432, JPEG picture, 1984, TIFF picture, 23724, «class BMP », 20422, «class TPIC», 1770, string, 0

And that's for a single, typed, unstyled, word.

1 Like

Fascinating. I don't really know how to interpret that, but it looks like OneNote is placing an image-flavour of the object into the clipboard and that's what KM's clipboard viewer is choosing to see.

OneNote is putting a shed-load of formats on the clipboard, including HTML, PNG, GIF, RTF, plain UTF-8 and UTF-16 text...

What I don't know is why KM isn't picking up on the plain text versions -- but I'd always start by blaming OneNote and not KM, until proven otherwise!

So it looks like it has at least a form of plain text (Unicode text).

I will take a look and see if maybe Keyboard Maestro doesn't look for text if it decides it is an image, or if it is a different form of text that Keyboard Maestro doesn't find. I might need to ask someone to send me a copy of a clipboard (which will be a bit tricky to do), but perhaps I can find it without that.

3 Likes

That sounded like a challenge, so I just wrote a macro to do that... I hope it works for you, it seemed to work for me...

2 Likes

OK, I've checked and Keyboard Maestro was not searching for text in clipboards that were displayed as images.

I've corrected that for the next version.

Note however that what the text is may not be what you expect depending on the situation. For example, control-click on an image with ALT text in Safari and it's likely the copied text is actually the image URL not the ALT text.

You can see whatever text Keyboard Maestro sees in the clipboard entry by selecting in and choosing Set clipboard to plain from the gear menu.

Also note that the Keyboard Maestro SystemClipboardFlavors token will show you the list of flavors in the clipboard entry, whereas the AppleScript clipboard info (or shell script osascript -e "clipboard info") will show you flavors that can be created from flavors in the clipboard which is quite different.

3 Likes