Read outdated note
Update: Say hello to the fastest "version 2" update I've ever done. The Macro Usage Counter is back, and much better than it was before.
It's now a zero-overhead macro, as the only thing you have to add to each of your macros is a single action that appends that macro's info to a tracking variable. The work now only happens when you ask to see the usage report—it calls the processor to update the totals before the report is displayed. This is how it should have worked from the get-go, instead of trying to do everything in the background, which just made things miserable.
I know Keyboard Maestro has some built-in usage tracking, and you can easily view your macros sorted by use order. But you can't see the actual counts in the sorted view; you have to use the inspector to see the count for a particular macro. It also tracks everything, all the time, and can't be reset (I don't think).
I wanted a tool that I would show all my macro usage in one report, that I could use to only track macros I wanted to track, and that would be easy to reset if I decided to do so (or, you know, had to do so during development because I did something stupid).
I decided to write my own simple tracker—mostly because I wanted the data to help thin my collection and see which macros I use the most, but also just to see what was possible. Here's the result—and this isn't really beta, as it seems to be working well, and there won't be any issues with updates (which is what caused me to pull this before):
macrousagecounter_22.zip (152.8 KB)
2.2 update: When usage counts exceed 1,000, they now get a comma in their displayed values. Also, and maybe more interesting, you can now live-sort any of the columns in the usage report.
2.1 update: A much-improved update routine (just run the update macro when you want to check), and a new framework that will verify in-macro updates, starting with the next update. Plus a reorganization of the macros in the macro group.
2.0 update: This is a total rewrite so that there's no background processing ever, and it works via a single "append to variable" action you insert in each macro. The work happens when you ask to see the report, which is (doh!) how I should have written it the first time.
1.1 update: I forgot to filter some variables that were used in regex searches to be regex safe. I warned you it was beta! If you installed the macro already, you can force an update check by deleting the global variable rg_MacroUsageCounter_lastchecked.
It's a very simple tracker—launch a macro, and the counter is incremented by one. But it does have some useful features…
- Built-in backups, both by copying the permanent variable to another, and by writing a file in the /tmp directory, which macOS automatically cleans up (at a longer interval than I would require to notice that my usage data is missing). I also try to apply some logic and not write a blank variable to the backup file, for instance.
- Restore from backup will compare the variable and file versions and let you pick which one you'd like to restore.
- This includes my macro update notification macro, which I haven't yet posted here but will, so you'll get notified when new versions come out.
- The report, as seen above, can be live filtered by typing in the box at the top. If you click on a row that you highlight with your mouse, you'll jump directly to that macro in the Keyboard Maestro editor.
- There are a few simple tools that make it easier to add the "count this macro" action to your macros.
To use it, download the macro and install it, then activate the macro group. There's a "read me first" macro with some additional details, but to start using it, here's all you'd need to do:
- Open the macro named 01) •• Add this to your macros •• and copy the red-colored action—this is the "append to variable" action needed to track a macro.
- Paste the copied action at the top of each macro you'd like to track. (You could also put it at the end, if you wanted to only track macros that you had used through to completion.) There is a tool to make this easier, with instructions, in the TOOLS section. Read the how-to there.
Each macro that has the action added will now start collecting data. The data won't be processed until you ask to see the report, so there's no overhead at all. Once the report appears—it's assigned to open with a double-tap of the right-side Option key, which you can/should change—you'll see it with data that's been updated since the last time you ran the report.
I'd love feedback on this—it turned out nicer than I thought it would, and I'm finding it very useful. (Especially being able to jump right to edit mode from the report; that's a nice timesaver!) It should be safe to use, as it doesn't modify any existing macros, and only runs when you add its activating action to your own macros. You can disable the backup and update macros if you wish, as they're independent of the counter macro.