Wish list: ability to export / backup named clipboards and question about App Support and Pref Files

Hello,
1- wish
I know that I can restore the named clipboards via

  • the ~/Library/Application Support/Keyboard Maestro folder and
  • ~/Library/Preferences/com.stairways.keyboardmaestro.* files
    according to KM Wiki.
    The problem is that a restore would entail restoring my entire KM which I may not want to do if it's only a question of restoring a few named clipboards
    I would like to have a more specific focused backup or export method for the named clipboards which contain many technical reference charts that I have accumulated over the years.

2- question
if I look at the different KM support and pref files in the Library, most are .plist including β€’ Keyboard Maestro Clipboards.plist which I thought would contain my named clipboards and technical charts, but I realized that ,plist are obviously text files. So where are all the images and PDFs in my named clipboards stored ?

thanks in advance for your time and help

The named clipboard images are very likely stored in the plist file. I think they are encoded using Base64. So they look like text inside that file. You won't see any images.

I don't think PDFs are stored in any plist file. I think all that is stored for a PDF is the name of the file, not the contents. So you can't restore it unless you have backed up your PDF files in some other way. Your PDF files are where the data is stored. I think. But I might be wrong.

There might be someone on these forums that can extract a named clipboard image from a plist file, but it certainly isn't me.

1 Like

What’s the problem that you are trying to solve ?

1 Like

to backup my named clipboards containing technical charts and PDFs, laboriously accumulated over the years. thank you

PDFs inside named clipboards are very pleasant to view by scrolling.

so if I migrate to another mac, PDFs inside named clipboards won't follow?

just for my education. Is it possible to reverse engineer from base64 txt to image ?
Backing up Keyboard Maestro Clipboards.plist would be a simple solution.

thank you

Firstly, the files in that folder are not really documented, so anything that happens in there is subject to change. You have been warned.

Also, touching any of those files (either reading or writing) while Keyboard Maestro Engine or Keyboard Maestro (editor) is not recommended. They may be corrupt, partially written, or you may damage them, crash Keyboard Maestro or otherwise corrupt them. You have against been warned.

Currently, the Named Clipboards are stored in the Keyboard Maestro Clipboards.kmchunked file, and the clipboard history (if it is stored to disk) is stored in the Keyboard Maestro Clipboard History.kmchunked. This file format is not documented.

If you have .plist versions of those files, you will likely find they have not been modified in years and are no longer used and likely very out of date.

You can backup and restore those files if desired while Keyboard Maestro and Keyboard Maestro Engine are not running.

1 Like

thank you very much Peter! crystal clear!

I think so. In fact there's a macOS command called "base64". You can read its syntax in the Terminal app with the command "man base64".

As I said, there are probably people here who are able to extract the data you want from the plist file, but as Peter says it's a very risky thing to do, and undocumented. Not only that, but we are approaching the likely time frame when the next major release of KM arrives, so any solution that is written today may not work tomorrow.

You keep saying, "PDFs inside named clipboards." What I'm saying is that PDFs are not stored inside named clipboard, just their name is stored. That's why they "won't follow."

yes, after reading your emails, I noticed that the clipboard plist files are dated 2019

Do those files contain the actual images and PDFs inside my named clipboards?

I run an automatic backup using carbon copy cloner of my config and other important files (/Users/jlette111/Library/Application Support folder including Keyboard Maestro subfolder) to an external SSD 4 x a day and have been doing so for many years.

that would mean that even though they are only reading the files, those backups are invalid if I had to restore the files, and that I must change my backup setup?

He said it's an undocumented file, so even if he says yes to your question, you still can't access the data.

1 Like

I would restore it to KBM

Ok, sorry, I was under the impression you wanted to extract the data, when you used words like "reverse engineering."

1 Like

thanks again very much for your replies and efforts

would you perhaps know how to quit and restart KM in 2 separate AppleScripts that I would insert before and after my named clipboards backup ? thank you very much

You should read this thread about stopping and restarting the KM Engine. Some of the advice in that thread comes from The Architect himself.

1 Like

I printed the link (and sub links) and will read it today. I am confused from the start: to backup the application support and preferences files, do I need to quit β†’ backup β†’ restart both the KM engine and the editor, or can I qui β†’ restart the engine only. I ask because the links talk about the engine. thank you !

Good question. It may depend upon which file you are worried about. If I scroll back, I see that sometimes this thread is talking about kmchunked files, and sometimes it's talking about the plist files.

The engine obviously writes to the kmchunked files whenever it wants to, which is where the named clipboards are stored. The Editor does have an autosave that writes to the plist files frequently, so if the data you want to back up is in the plist file, you might want to close the Editor too. I'm not certain if the Editor writes to the kmchunked files, or if the Engine writes to the plist files. So to be safe, you should stop both apps.

The reason the thread was talking about the Engine ONLY is because that's the tricky one to stop and start with the Engine. The Editor is trivial to stop and start with the Engine.

1 Like

something like this script to quit both ? thanks very much

tell application "Keyboard Maestro Engine"
	quit
	end tell

	
	tell application "Keyboard Maestro Editor"
		quit
	end tell

That looks like it will stop the Engine and Editor. Now that they have stopped, how do you plan to start the backup program? And then how do you plan to restart the Engine and Editor? Are you planning to do those things manually or automatically?

1 Like

They store whatever the clipboard entry stored.

So if the clipboard entry is a file reference, they store a file reference. If the clipboard entry is an image, they store the image.

A PDF could be stored as a file reference, or as the document in its entirety, that would depend on what the application put in to the clipboard.

Potentially.

Any file could be in the process of being written while the backup is reading the file.

This is always true of any live backup.

In practice, it is probably safe if Keyboard Maestro is not doing anything and has not been doing anything for a while, but in principle, and such file could be half way through being updated.