Macros.plist, is it possible to have more than one?

hi everybody,

I know that macros are saved/retrieved from the macros.plist file.

Is it possible to have more than one of these files? or to have subfiles inside this file?

I want to have macros that I share with somebody else.

Alternatively, is there documentation on the format of this file? I would then write a script to extract/merge a given set of macros. This script will be useful to have some sort of version control tool that is better than just keeping a large binary file.

thanks.

You can select the macros you want in the editor, then use File->Export->Export Macros or one of the similar ones, to share your macros.

And no, you don't want to try and have separate plist files. There's a lot more going on under the hood than you might expect.

KM's Plist format isn't documented, although there's plenty of information available here. Also, you can use Copy -> Copy as XML to see the details.

But be warned: this is a rabbit trail that starts off fairly easy, and becomes steeper and steeper as you go on. And believe me, I know - I've spent a lot of time on that rabbit trail! Not saying you shouldn't go there, but make sure you take along a lot of water and snacks, and don't expect to be home before dark.

Did I stretch that metaphor a little too much? Yeah, I thought so too. :slight_smile:

Thank you. I get what you are saying.

The top of my wish list would be that it would be possible to specify the (file) location of a macro. Or simply, each macro its own file.

For example: having a team macros file, and a personal macros file.

Such feature could increase the market of KM, since it would become a team tool.

ok, I found how to convert it:

(copy the file, since it this command will rewrite it)

plutil -convert xml1 Keyboard\ Maestro\ Macros.plist

The macros are relatively readable. I wonder the level of "debugging" support if this file is wrongly formatted (according to what KM expects). I guess testing is needed :slight_smile:

It would be really nice to have a command line KM parser that verifies this file. Sometimes I wish I could edit the macro with a real editor rather than the point and click interface.

Why not just create a macro group for the macros you share, and disable that group (and the macros in it) if you're not actively doing anything with it? That's what myself (and I imagine many others) do here on the forums.

-rob.

--------disregard below-------
Please correct me i am wrong. That still needs manual intervention within KM and cannot be automatized. You will still need to import/export any changes to the macros, correct?

What I envision is being able to synchronize macros with a team automatically, similar to the way they are synchronized across machines. If they lived in different files, that synchronization can be done outside KM.

---------up to here

oh, sorry I get what you are saying. The problem is that I have personal macros that should not be shared.

This is the bit I was missing from your original post: I didn't know you were trying to automatically sync macros across users and Macs.

I would expect zero debugging support, as that file isn't designed for user interaction.

I think a problem you'll run into is that users, once they have Keyboard Maestro installed, will want to add their own macros that aren't relevant to others on the team. But if they're using a shared macro file location, that's not going to work.

Also, you wouldn't be able to have all the Macs reading and writing that one file, because it's not designed for multiple simultaneous editing.

Because it seems very fragile to try to solve it this way, here's another option:

On Main Mac, created a Shared Macros group that exports every so often, to a shared location. On Client Macs, write a macro that does something like (1) wait for any running macros to finish, (2) deletes the Shared Macros group, (3) imports the Shared Macros group, (4) enables the imported group.

Users wouldn't be able to customize these macros at all, as they'd lose that work each import cycle, but they wouldn't be able to do it in the other scenario, either.

Just a thought.

-rob.

KM can drive itself. KM macros can be triggered from the command line. KM is also scriptable. It wouldn't be that difficult to create something that exported certain "Shared" groups to a repository, nor to write a macro for the clients to update against that repository. You could even create macros on the fly.

Having two macro "databases", one personal and one team, could be anything from difficult to impossible -- I'm missing out "easy" because, if it was, @peternlewis would have probably done it by now!

Plot twist! A (forum first?) Pink Floyd reference:

Run, rabbit run
Dig that hole, forget the sun
And when at last the work is done
Don't sit down it's time to dig another one

Best. Album. Ever. Period.

2 Likes