MACRO: MacroBackerUpper—it's like Time Machine for your macro library

Digging the report :+1:

2 Likes

Version 1.1 is out, and fixes a bad issue for anyone using 0.000,00 number formats: MBU wouldn't work. This boiled down to be a misunderstanding on my part as to how "Format With" works in Calculation fields, but I was led astray by what I found to be confusing wording on the wiki page. (Peter has now added a note there to help.)

This version also adds a check to make sure your backup folder isn't named Untitled Macros Folder, which KM sometimes does if there's a timing glitch when I try to insert the proper name. I think I've set it up so that this will always be caught and fixed before the macro proceeds.

I also added a bit of code to each AppleScript call to try to prevent some random (and not-the-macro's-fault) 600 errors that you may see—thanks, Chris!

My apologies to those with comma-separated decimals for the troubles; the thing ran perfectly with period-delimited decimals, and none of my testers used the alternative format.

-rob.

2 Likes

Thanks! When I first started this thing, it was almost an afterthought, like "Oh, I could try to see how things have changed." Now it's one of my favorite parts of MBU, and I look at it when trying to figure out what stupid thing I might've done to some macro or group :).

-rob.

1 Like

Thanks, @griffman. MBU has been running perfectly for me!

1 Like

Thanks @griffman ,
works great now

1 Like

Glad to hear it, and thanks for the debugging help!

-rob.

Works great for me as well.

1 Like

Ditto what I said above - thanks for the debugging help, I don't know how long it would've taken me to find the problem without both of you helping out!

-rob.

1 Like

This is really impressive! Thank you very much.

1 Like

Hey @griffman,

Just wanted to provide an update and some observations on these great macros.

Feature Request:

  • If Keyboard Maestro is hidden when the macro starts, rehide it after the macros are exported.
    • I did this on my personal copy, but when I download updates I have to do it again; having it incorporated into the official release would be nice.
  • Only show the final report if manually triggered
    • Otherwise just a Notification Center notification if ran from idle/periodic/time of day trigger etc.

Bug Report: shell scripts status 1 errors
The following shell scripts return A LOT of Task failed with status 1 errors...

Action Screenshot from macro: tasks | 06 Analyze modified groups (click to expand/collapse)

Action Screenshot from macro: 06 Analyze modified groups (click to expand/collapse)

Action Screenshot from macro: 06 Analyze modified groups (click to expand/collapse)

Bug Report: broken execute a macro action

There is a missing execute a macro action in the following macro: upd | Update check (click to expand/collapse)

I haven’t had time to look into your last DM about the AppleScript but I’ll try and brainstorm something this evening.

Thanks again for a great macro system!

-Chris

1 Like

I think these are great ideas. If I could add my feature requests/things I intend to look into on my own:

  • Run periodically without user input (other than the option to cancel like during "Present countdown timer for settings access" prompt)
    • My use would be to run this periodically from an always-on mac, provided the user has not moved the mouse recently ("is afk") and/or the KMsync file has not changed recently.

Thanks again @griffman, I really love it.

I'll work on the feature list, as for the periodic option, it's how I have mine set. However, I don't like distributing macros that automatically run on a periodic basis; it somehow feels "wrong" to me to put something on someone's Mac that runs without their saying "yes please run this."

I do show a couple options in the help for users who want to add automatic usage—periodic or idle—for those who may not be familiar with those triggers.

-rob.

That’s a good point. I’ll have to go read the documentation a little more thoroughly. I guess I just need a way to disable the final dialogue, but to be fair, I have not looked to see if such a thing is included yet. I only just tried it this morning. Thanks again

It's not, but it will be in the next release.

-rob.

1 Like

I'm 99% certain these are unavoidable, due to the way diff works. This tripped me up in the past, and drdrang was able to figure out what was going on:

The answer lies in how diff works. When diff finds a difference between the two files, its exit code is 1. Nonzero exit codes typically indicate an error, so when Keyboard Maestro sees that exit code, it bails out. If you look through the Engine.log file, you'll see something like Task failed with status 1 which is true but not very helpful if you don't know diff's exit codes.

The workaround is to click on the gear icon in the upper left corner of your Execute Shell Script action and change the settings on "Failure Aborts Macro" and "Notify on Failure" from ✓ to ×. That should get you the output you expect.

So that's what I have to do whenever I use diff (and a couple other commands, as it turns out). But I don't know of any way to block the log entries for these things that aren't really errors.

-rob.

1 Like

Hi, @griffman. Thanks so much for your responsivenss to the issues that have been discovered during the roll-out of MBU! Considering the amazing functionality of MBU, it seems that the issues have been relatively minor. (Are you getting any sleep now? :sleeping:)

Coincidentally, I'm working on a macro (named: Engine.log Tool) that has some functionality that you might consider if/when implementing the above MBU enhancements.

Engine.log Tool that has three modes, one via direct trigger and two via calling macros that use the Execute a Macro action.

When Engine.log Tool is run via direct trigger (Mode 1) it displays a Prompt For User Input dialog with seven buttons.

For one of the buttons (Reduce) there are sub-options that are presented using a Prompt With List. (Coincidentally there are seven sub-options.)

When two of the five sub-options are selected, the macro does its respective task and then reports results.

For the other five sub-options, additional information is required and obtained via Prompt For User Input dialogs (customized to the particular sub-option). Like with the other two sub-options, the five sub-options complete a task and report results.

(This might sound complicated, but the macro is easier to use than to describe. :grinning:)

With Modes 2 and 3, the information that would normally be supplied by the Mode 1 user responses (dialog+PWL or dialog+PWL+dialog) is supplied by the callers via the With Parameter. The only difference between these modes is that Mode 2 reports results and Mode 3 runs silently.

For example, one of the sub-options is delete. For Mode 2, the caller supplies delete in the With Parameter. For Mode 3, the caller supplies 0:delete in the With Parameter.

Engine.log Tool includes this simple set of actions to determine the mode of operation...

If Then Else.kmactions (2.3 KB)

Version 1.2 is out now, with two Chris-requested features and some bug fixes :).

New feature #1 is the ability to control when (or if) the final onscreen summary dialog appears. You can set it to Always, Never, or Only if macro manually triggered. If you select the last option, you'll only see the dialog if you run MBU via its keyboard shortcut or directly from the KM editor.

New feature #2 is that MBU now tries to clean up the house before it leaves: It checks and saves the condition of the Keyboard Maestro app (running and visible, running and not visible, or not running), then restores that condition when the backup is done. So if you run MBU on a timer, you'll see KM open when it starts, but then (hopefully) also see it quit when the backup is done.

I also fixed a bug (thanks Chris!) in the update routine that was causing it to fail. So you won't be able to use the update manager this time, as it'll break. (If you want to fix it, just take out the call to launch the missing macro in the Update check macro.)

-rob.

3 Likes

I must be tired because I can't really tell what your macro does from reading :). I assume it's some sort of log manager that lets you easily find and remove entries from the log?

-rob.

1 Like

Hi, @griffman. The information I supplied was simply to describe how you might handle various modes of operation. But obviously my description missed the mark. I’ll send you the macro via PM so you can see my comments in context. I’m not quite ready to release it in the forum.

Ha, I totally missed that! See, I am tired!

-rob.

1 Like