One-script macro subroutine for timing macros

There are some older threads (2016ish) here with good advice on how to add a macro duration calculation to your macros. I wanted one to use for my URL cleaner to test a few different approaches and find the fastest solution. I got tired of adding the start time, stop time, and display results actions to the macro in various spots, so I came up with a single macro subroutine to do the work.

To use, add an Execute Macro action where you want the timer to start. Set it to execute the s-theTimer macro, then use the gear icon to set enable both With Parameter and Asynchronously. In the parameter box, type start. Once set up, copy the action.

Next, move to the spot where you want to stop (thanks @rcraighead!) the timer, and paste. Uncheck the Parameter box, and you're done. The timer will start and stop and display the results (in a "brief text" window by default).

I was a bit worried about overhead from calling another macro, so I wrote a simple test case: start timer, delay 1.5 seconds, end timer. I ran this multiple times, and the results were always within portions of a portion of a second of one another—in this case, in fact, the called macro was faster:

Timer in macro: 1.502084
Timer called: 1.501924

At the thousandths level, honestly, I don't even care. I like that I can now easily add a timer to any macro by just calling one macro twice.

Macro is attached, disabled. Enable and test, and let me know how it works for you.

-rob. (11.8 KB)


Nice job! I have a “time a macro” macro as well but I didn’t go about it this way. I like your use of parameters to have it differentiate between starting and stopping the timer.

You could actually take the two execute a macro actions with the appropriate parameter settings, export them, and then set up another macro to import them with their settings already saved. I have this set up for most commonly used actions via buttons on my stream deck. Of course you could just assign them any kind of trigger to import them, doesn’t have to be a stream deck.

Good idea on the auto import thing; hadn't considered that!


Very nice! I'll give it a try. I think you meant "where you want to stop the timer,"

Doh, fixed!


1 Like

You're aware of KMFAM – yes?

MACRO: [KMFAM] Favorite Actions and Macros (incl. Big Sur patch)

You can roll-your-own in several ways, but @DanThomas' KMFAM is by far the most flexible and sophisticated.


I remember seeing it in passing at one point and thinking "Wow, that looks amazing, I should try that someday."

But as Creedence once sang, "…someday never comes." :slight_smile:

Bookmarked for future exploration, thanks.


Yes! A few months back I downloaded it, imported it, then forgot all about it until you mentioned it. Thanks for the reminder! :sweat_smile:

1 Like


I changed the 'stop' routine to look for a trigger as well—this way, you can pass in text for the notification that appears for the timer.

Start still works that same, call with 'start' as the parameter. For end, call with whatever text you'd like to see in the notification box as the parameter. (11.9 KB)


1 Like