Continuing the discussion from Feature requests: Easy way to backup and restore macros, separate windows for macros, turn off auto-save:
- I also have long wanted an easy KM Macro Backup/Restore system.
- So, in collaboration with Chris @ccstone, we developed the backup script, and Macro.
- I have to say this runs very very fast, taking << 1 sec.
- The below macro provides the Backup part
- Easy to Restore Using Finder and/or Path Finder
- Set Finder to your Backup Folder
- Filter using the Spotlight Search box at the top right
- View the filtered list in order by time stamp
- View the contents of selected files using either Quick Look, or the Path Finder Preview panel
- Double-click on the
.kmmacrosfile you want to restore
- ADDS (does not overwrite) the Macro to the same Macro Group
- Edit as needed
- See below for how to use, and examples of output.
Examples of Output
Standard Notification when Done
Example List of Backup Files
MACRO: Export (Save) Selected Macro @KM
~~~ VER: 2.2 2019-03-23 ~~~
Export (Save) Selected Macro @KM.kmmacros (22 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
It was also uploaded with
- a trigger of ⌘S, which is NOT used by the Keyboard Maestro.app.
- In a Macro Group activated ONLY when KM is frontmost.
As always, please feel free to post any questions, issues, and/or suggestions that you may have about this macro.
Export Current Macro being Edited to a Backup Folder
- Macro File is Macro Name & Time Stamp
- Illegal File Chars ("/" and ":") replaced with "╏"
HOW TO USE
- Select a Macro for Editing in the Keyboard Maestro.app
- Trigger this macro.
Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me. ??
- Assign a Trigger to this maro..
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro.
REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)
Set Local__BackupFolder -- POSIX path to folder you want to save all macro backups.
- Set Local__BackupFolder -- POSIX path to folder you want to save all macro backups.
- If you want to use the script without passing the BackupFolder path to it from KM, then you will need to change this property statement in the script:
### USER SCRIPT SETTINGS ### -- HFS Path to Your Macro Backup Folder -- property ptyExportFolderHFS : "CHANGE:To HFS Path:Of your:Backup Folder:" ###JMTX ADD
- KM 8.2+
- macOS 10.11.6 (El Capitan)
TAGS: @Macros @Backup @Save @AppleScript
- Any Action in magenta color is designed to be changed by end-user
ACTION COLOR CODES
- To facilitate the reading, customizing, and maintenance of this macro,
key Actions are colored as follows:
- GREEN -- Key Comments designed to highlight main sections of macro
- MAGENTA -- Actions designed to be customized by user
- YELLOW -- Primary Actions (usually the main purpose of the macro)
- ORANGE -- Actions that permanently destroy Variables or Clipboards,
OR IF/THEN and PAUSE Actions
USE AT YOUR OWN RISK
- While I have given this a modest amout of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
- If you have any doubts or questions:
- Ask first
- Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.