Set default location for exporting macros

I love exporting macros to share with other users. I even made the macro to do this:

But my biggest issue and annoyance is that I can't actually automate it. The reason is that by default the save location is something I can't predict because it carries over from some other place I saved something.

I want by default to have all my KM macros exported to ~/Desktop. Would it be possible to allow users to set a default location for exports please?

Honestly, what is probably the easiest solution for this is to use Default Folder X, which among its many useful features lets you set default folders by app:


This is how I solved this problem for myself in my own macro-export macro, and it works so well I'd completely forgotten I'd even done this.

1 Like

This is amazing. I actually have Default Folder X but didn’t know it had this feature. Thank you @gglick

1 Like

Hey Gabe,

You may or may not know, but Default Folder can be AppleScripted to change the default open or save location on demand.

I've had an export macro that makes use of this for many years, and it might even be on the forum somewhere.

Nevertheless – the current method of exporting macros is painfully inefficient and inflexible – so let's see if we can do something about that...

The appended macro directly exports the SINGLE selected macro in the Keyboard Maestro Editor to an appropriately named .kmmacros file in the designated exports folder.

It also reveals that file in the Finder for quick access.

Peter – It would be lovely if it was possible to get the XML of macros directly with AppleScript instead of having to copy it to the clipboard to gain access.


Export the selected Keyboard Maestro macro.kmmacros (6.1 KB)


I knew that Default Folder X was scriptable, but I still don’t know how or when to take advantage of it since I still don’t use the app much beyond its base functionality, so this is good to know about.

Thanks so much for this, Chris. This is a much faster way of exporting macros, and it was easy to incorporate into my existing macro exporting workflow, which also copies and resizes an image of the macro for the forum and opens the exported macro in LaunchBar rather than the Finder, so as not to clutter my desktop with extra Finder windows. The way you solved this problem was great too, so as a still-novice AppleScripter, thank you for another illustrative example as well.

Can you share that macro too? :slight_smile:

Sure, but it's actually a series of macros, since I use numerous "sub-routine" macros to accomplish this:

Export Macro (7.7 KB)
21 PM12 PM
39 PM

The Copy as Image macro uses @Tom's excellent macro found here:

Though I've included it in the zip for convenience.

The way I open LaunchBar (modified to Alfred by default for this version) to the exported macro is with this simple change to @ccstone's AppleScript, replacing the Finder tell block:

#Comment or un-comment out the tell block for your preferred launcher

tell application "Alfred 3"
	browse theMacroFile
end tell

--tell application "LaunchBar"
--	open theMacroFile
--end tell
1 Like