Odd behaviour with named clipboards

I have a Macro that will copy content to a named clipboard (That is the only function in the Macro).
In this case, the content is a graphic that has "History" on it.

Now with the content saved on my named clipboard, I want to paste it. Using a named clipboard means that I can paste this content at any time using a keyboard shortcut without having to recopy it to the clipboard, or having to worry it being lost from the clipboard history if I do lots of copying and pasting from other apps.

I change my macro so it says "paste from" instead of "copy from". But instead, it pastes a completely different graphic. One that says English:

Why is this happening? (Again, "paste from" is the only function)

Steps I have tried
-Creating a new named clipboard
-Deleting all other named clipboards and then creating a new named clipboard
-Uninstalling and reinstalling KM
-Deleting all other macros to do with pasting graphics

Any ideas?

NB. The English graphic was originally used when I was first testing out name clipboards, but since then I have deleted the named clipboard that contained that graphic, so I don’t know why it keeps on appearing now.

Background:
I have a document that has over 500 pages. I need to paste different graphics depending on the page, using a keyboard shortcut for each graphic, so I'd certainly appreciate some help. (I started a thread here, but the question has changed since then, which is why I started a new thread)

1 Like

Yikes, you tried reinstalling KM? That's pretty desperate. That was overkill. And it doesn't address the issue if the issue is interference from one of your existing macros, and I can see from the screenshot that you have scores of macros.

When you said "Deleting all other named clipboards" did you delete the named clipboards using the KM Preferences / Clipboards window pane? Have you used that pane before?

You said you "deleted all other macros to do with pasting graphics". You don't have to (and probably shouldn't) delete macros, all you have to do is disable them using the flag in the group that contains them. But even so, you said you deleted the ones having to do with pasting clipboards (which doesn't modify clipboards), when the real issue should be the macros that modify clipboards (which is the copy action, not the paste action.)

One possibility that COULD be the problem, since you haven't actually eliminated it, is that you have another macro that's also modifying the named clipboard, possibly through a trigger that you don't realize is being triggered. The best way to eliminate this is to deactivate all your groups except for the group that contains these TWO macros.

So my plan to debug this is as follows. Disable all your macro groups. You have only about a dozen groups so that will take only a minute. Put these two macros into a single group, and activate that group (it will be active by default). And probably delete your named clipboards to be sure. Then run your test. This will eliminate a lot of possible causes to your problem. If this test causes your macro to work, we have a good idea that something else is interfering. If this test still doesn't fix your macro, then the problem is within your short macro. And right now I can't see what that might be.

The purpose of my plan in the previous paragraph is to determine if the source of the problem is within your two macros or somewhere outside. So that makes it a pretty useful test. There's a possibility some elite wizard could just read your macro and see what's wrong, but I can't see what's wrong there.

1 Like

Yup, I deleted them from Preferences > Clipboard. There were two which I couldn't delete because they belong to another macro. But all the ones to do with this 'graphic project' have been deleted.

This is what I have done:

  1. Disabled all Macro groups apart from 1 group which contains the pasting macros.
  2. Deleted all macros in this group (there were only two macros anyway)
  3. Deleted all clipboards, apart from two clipboards that are used by other macros (as deleting these clipboards only causes them to be recreated).
  4. Made a new macro:
    Trigger: CTL+ALT+CMD+M
    Action:
    Cut to clipboard: New-test-board
  5. I go to my document and find the image I want to cut.
  6. I press CTL+ALT+CMD+M. The image is cut.
  7. I go back to the Macro (in KM) and change the action to: Paste from clipboard: New-test-board
  8. I go back to my document and press CTL+ALT+CMD+M.
    Result: The wrong English image appears :confused:

Interestingly, in step 7, I can see that one of the old clipboards I created ages ago for testing (SK Religion Left) reappears (even though I deleted it). I am not sure why it comes back, because I disabled all my Macros. I've looked through the disabled Macros and can't find it listed any way (although I do have lots of Macros, so I could be missing it).

Also, "SK Religion Left" just displays as "Empty Clipboard Text". It doesn't seem to contain the English graphic.

05

Is there any way I can nuke it permanently just so I can rule it out?

Thank you so much for all your help and patience. I really do appreciate all the time you have spent on this.

I enjoy helping people, so don't worry about that. I think I usually succeed. If I don't succeed, probably someone else will step in.

I have a couple of ideas. Let's try this one. Open the debugger. You do this by clicking on the KM icon the the System Bar and pressing on the menu item Start Debugger (it needs to have a checkmark in the box.) Verify that nothing is running in the window. Then click on the button Pause New Macros inside that window. Then run your tests again. When you run your test a macro name will appear inside the window and you will have to press the little Play button beside the macro name or it will not run.

This is important because you will see in that window the names of every macro that starts up. The reason I want you to do this is so that we can be sure nothing else is being run. The reason I'm suspicious that something else is running is because you have that new clipboard entry that starts with SK. This test could uncover something surprising, but if it doesn't, then it points to your macros as being problematic. In which case we might ask you to download our macros or upload your own.

Thanks for the debugger. I tried it and it displayed the Macro exactly as it is, with no interference.

Here is the debugger when the Macro is set to "cut to clipboard":
34

And here it is when it is changed to "paste from clipboard"
09

No other actions appear in the debugger.

It's odd that the English image keeps on appearing.

Regarding the "SK Religion Left" I found out which Macro that was contained in. I deleted the Macro and now "SK Religion Left" has gone for good (I deleted it before doing these tests).

Hmm. Well even though that didn't solve the problem it does narrow down the possible cause, which is one step forward. Now try opening the Clipboard history Switcher. That is opened by executing this macro:

image

I'm not very experienced with that window but we can get some clues from this approach. In the window that opens you will see all the clipboards you have used. I think that will include your erroneous English language image, let me know if it's in there. Then delete it. You can delete multiple entries at once by selecting many of them, and right clicking and click on Delete at the bottom of the pop up menu. Once the English image is gone, I'm not sure how it could return. That may not be a permanent solution, but it might help us understand what's wrong here.

Remember, I'm just an average guy here, not one of the leaders on this website. If you don't think we're making progress, just ask me to stop helping, I won't mind.

One little thing bothers me. You said you modify the macro to make it switch from a copy action to a paste action. I would prefer that you create a second macro which does the pasting. Maybe the trigger could be CTRL-ALT-CMD-P for paste.

Hmm... The English image wasn't on the clipboard. But I deleted everything on the clipboard anyway. And it still appeared!

However, I tried another Affinity Publisher Document and it worked fine there, so I wonder if there was something wrong with the original document? Although it works fine in the new document, it doesn't seem to copy over all the layer data, so I am working on a different approach to my situation.

I wonder if the Keyboard Macro clipboards don’t work exactly like the system clipboard.

For example, here is a different but related project. In the Mac Calendar app, I like my Calendar entries to have lots of notifications like so:
43

Entering all these alerts is a pain, so I will normally copy an existing Calendar entry (that has all these alerts) to the system clipboard and then paste it on the "day square" of the Calendar app where I want the entry to be.

To make the process more efficient, I copied the entry to a named clipboard. That way, I could just type a keyboard shortcut to paste the Calendar entry without having to copy it first.

But it doesn't seem to work. In fact, when I look at the named clipboard in KM preferences, it seems to be missing most of the data:
46
All the alerts are gone from the named clipboard.

So I wonder if these Keyboard Macro clipboards don’t work exactly like the system clipboard

Your help was wonderful, as you taught me lots of debugging steps. I now know a lot more about troubleshooting thanks to you. Thanks again!

Some apps put data on the System Clipboard for its own internal use only. If you switch to another app, the first app removes and/or changes the data on the Clipboard just before it loses focus. That may be what you are seeing here.

Generally the KM Action "Copy to Named Clipboard" should work fine, but you might try using these two Actions instead:

image

If you want more insight into exactly what is on the Clipboard, you might obtain a Clipboard viewer app. I have been using this one, which is free and works well for me:
Clipboard Viewer

1 Like

Let start with some basic background info:

  • Clipboards are made up of lots of “flavors”, each of which can contain different information (typically this lets you have different styles of the copied item, eg plain text, right text, web archive, pdf, tiff, png, etc).
  • Copy to Named Clipboard is very simply ⌘C, followed by save all the flavors in the system clipboard to a specified named storage in Keyboard Maestro.
  • Paste from Named Clipboard is very simply set the system clipboard from all the flavors in the specified named storage in Keyboard Maestro, and then ⌘V.

So. After you do the Copy to Named Clipboard, what shows in the Keyboard Maestro Clipboards Preferences?

There are two likely causes for this:

  • The application has a variety of flavors on the clipboard, some of which say "History" and some of which say "English" (for some bizarre unknown reason).

  • There is some level of clipboard caching going on, so that when the Copy happens the application is not actually setting the system clipboard properly, or after Keyboard Maestro sets the system clipboard, the application is not actually reading the clipboard properly.

1 Like

For the graphic project: it just says "Unknown Clipboard data".

Interestingly for the Apple Calander clipboard, it just says Scheduled: 15 Oct 2019 at 08:00 to 08:01
None of the alarms or alerts I set (see the graphic in post above) are visible.

So it is probably using proprietary flavors. Maybe those flavors have references that do not remain valid.

As I mentioned, clipboard entries have many different flavors. Keyboard Maestro can only display text, some styled text and image flavors. Calendar entries have lots of flavors and including plain text versions that Keyboard Maestro can display.

Thanks for clearing that up. Thanks also for making KM so awesome. Although I wasn't able to solve my graphic project using the clipboard, KM was so flexible that I was able to come up with a work around that was just as good. And in coming up with the work around, I figured out solutions that helped me with other tasks, so thanks again!

1 Like