I am a huge fan of Keyboard Maestro and use it every day.
Two days ago a weird thing happened: apparently due to some kind of syncing error event, I had duplicates of most or all of my scripts. Trying to run a script would result in KM asking me which script to run, and some scripts ran twice at the same time.
I went through and deleted the duplicate macros, but now I have a new problem: commands that should work from inside an Applescript now generate an error, shown below. It seems that I cannot execute these commands from inside an AppleScript that KM is running.
tell application "Keyboard Maestro Engine" to do script "run some script"
tell application "Keyboard Maestro Engine" to setvariable "saveSomeVariable" to 1 as integer
Does anyone have any suggestions about how to get this functionality back? I frankly use Applescript to save variables and run KM scripts all the time. Is there a way to export a "clean" version of all macros and re-import them, if I'm looking at a corrupt file?
OK, part II to my problem. Since my KM set up was completely broken, I took the extreme step of exporting all of my macros, several times, using Export Macros, Export Macro Library, and Export Macros to Folder. I thought that I could add back my Macros one by one, verifying that they were working.
Well. I did this, but to my shock and horror maybe 40% of the macros did not get exported, and appear to be lost. I thought, no problem, I'll load my shared KM library from a Time Machine backup on another computer, so I can see which macros are missing and fix things. BUT.... loading the kmsync file doesn't seem to restore my macros, and I can't see how to import macros from a recovered folder in Application Support inside Library.
Basically, I desperately need to restore my Macros from a Time Machine backup so I can rebuild my workflow scripts, but I can't see how to do this. Please help!
The Time Machine backup should have everything you need to restore your Library (but you would not use the kmsync file from the Time Machine Backup - you would do this).
But there is a simple option that does make use of the kmsync file if you have been syncing via Dropbox (and I have had to do this a few times so I know it works). Do you use Dropbox for syncing? If the answer is yes, you will be able to restore the kmsync file to a previous version directly in Dropbox.
On your main Mac set Keyboard Maestro to sync its Macros and point it at the same kmsync file in Dropbox that you have always used.
Initially it is just going to sync to the current state with Macros missing etc
Quit Keyboard Maestro
In Finder go to the Dropbox kmsync file, right-click and choose "Version History"
This will take you to Dropbox on the Web where you can restore the kmsync file to an earlier date.
Restart Keyboard Maestro and your Macros should be back.
Once you have your Library back, this is the option to use:
If you really want to restore from a kmsync file, ensure that the kmsync file is at the version you want to install it from, and turn on Macro Syncing on the Mac you want to replace the entire macros for, and select the kmsync file for Opening. Read the warning carefully. After sync, you can turn syncing straight back off again, so the kmsync file can be anywhere.
THANK YOU for your help. I was able to get functionality restored by replacing the whole KM folder in Application Support. The weird bug that was giving errors when I did certain KM commands seems to be gone.