MACRO: Get Recently Run Macros with Last Executed Time

Yep, that was it! Really nice. Thanks! :clap:t3::clap:t3:

1 Like

Hi @ccstone. Do you know of there is a similar macro that will also list subroutines (executed by triggered macros)?

Hey Jim,

As far as I can see subroutines are not included in the Keyboard Maestro Engine Log when they are run, so there's not a convenient method.

I suppose you could get the macro list from the log and then:

  • Parse the XML of each macro for subroutines: <string>ExecuteSubroutine</string>
  • Pick up the UUID for same.
  • Then run an AppleScript to discover the last execution time of the subroutine and compare that to the execution time of the macro.

I think it could be done, but it would be a lot of work.

-Chris

1 Like

Perhaps easier for @_jims to add a "Log" action to any subroutines to be tracked, then leverage your original script. I'll confess I haven't looked -- is there a particular format to log so the line gets picked up?

2 Likes

Good idea.

And yes – there's a particular format.

1 Like

@ccstone and @Nige_S, thanks for the suggestions.

@peternlewis, for subroutine executions, please consider adding a Preferences Set by Command Line, maybe to:

defaults write com.stairways.keyboardmaestro.engine

Thanks, all!

Only triggers are shown in the log - executed macros (via Execute a Macro or Execute a Subroutine actions) are not shown in the log file.

If you want to log them, add a Log action to the start of the macro.

3 Likes

Hi Dan,

I'm looking for a way to get the last executed date just for a single macro (maybe by UUID would be the best option). My knowledge of Javascript is close to nothing (I would even say it's nothing, to be honest).

Would it be easy for you to share a customized macro to just do that?
If not, I understand that these things take time and energy, and I will find a workaround.

Thank you!