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.
__ Macro Usage Counter 3.4 Macros.kmmacros (242 KB)Version 3.4 (Jan 12 2024): Changed update routine to only show a notification if there's a new version available.
Older versions
Version 3.3 (Dec 7 2023): Again with thanks to @cherry, an error that would double-count macro usage under some situations has been found and fixed.
Version 3.2 (Dec 6 2023): Thanks to @cherry, I found and fixed a fundamental issue: The tracking macro was calling the wrong tokens! This would lead to a double count and a missed count if you ever called the tracker from a main macro, and then again from a sub-macro called by the main macro.
Please update to 3.2, and replace all calls to the tracker with the action in this version of the macro. I am so sorry!
Version 3.1 (Dec 5 2023): Fixed an oversight in my logic that prevented the reporter from updating before there were 15 rows to process.
Version 3.0 (Dec 5 2023): This is basically a total rewrite of everything other than the report screen. The macro now uses a database, which is a great improvement over large global variables. It's faster, harder to mistakenly delete, and easier to back up. When I first wrote this, I didn't know how to use mysqlite3
databases with Keyboard Maestro, which is why I used global variables. Now that I know, this is how this macro should've been written from the start.
Existing users, if there are any of you out there, the macro should see that you're an existing user and migrate your data to the database. Just to be safe, keep version 2.4 around, and make a copy of the data in any rg_MacroUsageCounter...
variables before you run the new version. (I upgraded two separate Macs, and both went well.)
2.4 update (Oct 7 2023): Fixed an issue in the back up and restore routines that affected their ability to back up and restore. Whoops.
2.3 update (Mar 29 2023): Added a new macro (in the Tools section) to reset all tracking data, and fixed a couple of bugs.
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 backup and restore feature.
- 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.
- Includes a macro that inserts the tracking macro action into 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 •main-user | 01 Insert tracking macro call and add the red-colored action to any macro you wish to track. The macro explains two ways to do that.
- Do your normal macro stuff. 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.
- Run the
•main-user | 03 Show usage report
macro. This will then walk through the database setup, and import any tracked macros into the database. (It will also import the old variable-based tracking data into the database, if you used a version of Macro Usage Tracker prior to 3.x.
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 unless 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.
-rob.