Remove Failed Prompt With List Action From KM Engine Log

Howdy folks,

I like to keep my Engine log file as clean as possible, but as many of you may know, cancelling or escaping out of a Prompt With List action results in a failed action entry. For me, these entries are irrelevant, and can clutter my log when I’m looking through it for other failed actions that I consider to truly be failures. Therefore, I wrote a macro that can be run as a subroutine that, when placed after a Prompt With List action (with Cancel macro upon failure unchecked), will remove the action failed line if you escape or cancel out of the prompt. I have been using it quite extensively since January without any issues, so I figured I would share it here in case anybody else has a similar desire.

More details and screenshots are below. As usual, feel free to share any comments or suggestions, or to let me know if it doesn’t work for you.

-Chris

Download Macro(s): 54)[MG-SUBRT] Remove prompt with list last action failure from KM Log.kmmacros (9.8 KB)

Macro Image (Click to expand/collapse)

Macro Notes (Click to expand/collapse)
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
  • The user must ensure the macro is enabled.
  • The user must also ensure the macro's parent macro-group is enabled.
System Information (Click to expand/collapse)
  • macOS 13.6.6
  • Keyboard Maestro v11.0.2

CURRENT VERSION: 1.0.0 (Monday, January 29, 2024)

Version History

v1.0.0 Monday, January 29, 2024
Initial macro

RELEASE NOTES, INSTRUCTIONS AND DISCLAIMER

Purpose of this macro (click to expand/collapse)

Remove failed action from KM Engine Log

How this macro works (click to expand/collapse)

The shell script searches the Engine log for the most recent failed action line that corresponds to a cancelled Prompt With List action (based on a timestamp set upon macro execution) then removes that line from the log.

How to use this macro (click to expand/collapse)

Place it as a execute macro or execute subroutine action after your Prompt With List action, and disable the Cancel macro upon failure option in that Prompt action.

How to configure this macro (click to expand/collapse)

No configuration necessary beyond configuring the Prompt With List action settings wherever you want to use this.

Disclaimer (click to expand/collapse)

TL;DR: I built it and it works for me. You can share/modify it how you want. But don't blame me if it doesn’t work for you :laughing:

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

1 Like

It would be so nice if the log respected the settings in the Gear icon. If I disable notification of failure, the log shouldn't care about the failure either :). I can understand why Peter wrote it this way, but personally, given I took the action not to be notified, I shouldn't be log notified either.

Thanks for the macro!

-rob.

This is an unwise goal in my opinion. The log is there to report triggers and errors, that is its primary purpose.

If you want information from the log in a more structured way, then you are probably misusing the log, but even so, if you do, you are better off making a filtered copy of the log to look at than trying to remove things from the log.

Because sooner or later you're likely to be trying to figure out why something is failing and that thing you're removing from the log will be the clue that you need.

Personally, I rarely look at the log unless I've explicitly turned on some excess logging, or to check for macros triggering or unexpected errors.

In any event, not putting things in the log is probably not something I'm going to do.

2 Likes

Yea, that's why I didn't actually ask for it, just said I'd personally like it :). And I fully understand why it works the way it does.

-rob.

1 Like

For those that use the macro Engine.log Tool, another way to remove these PWL entries is to use the purge reduction method.

Download: Engine.log Tool–purge-PWL returned without an answer.kmmacros (1.6 KB)


This method will move a copy of the Engine.log to the trash before modifying the log. Thus, if needed, the original log can be restored.

The 0: directs Engine.log Tool to do the reduction silently. If it is excluded, a dialog will appears like the following:


EDIT: 2024-05-25 14:2339 EDT

On second thought, in the spirit of keeping the Engine.log free of noise, the With Parameter could be set to:

0:purge:(Prompt With List returned without an answer)|(%ExecutingMacro%)

That would also remove it's own trigger event.

1 Like