Display Last KM Macro Error

MACRO:   Display Last KM Macro Error

~~~ VER: 2.0    2018-03-21 ~~~

updated 2018-03-21 18:54 GMT-0500

  • Fixed Bug caused by changes in KM logging syntax
  • Added Output of last 5 logs if error can't be found.
  • Change all KM Variables to Local Variables

DOWNLOAD:

Display Last KM Macro Error.kmmacros (33 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


Example Output

image


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Display Detailed Info about Last Macro Error

RECOMMENDED SETUP:

  • Macro Group: One that is Active for ALL APPS
    (I use "Global Macro Group")
  • Trigger HotKey: ^⌥⌘E
  • Trigger by Name: "km error"
  • Trigger by Status Menu

HOW TO USE:

  1. Immeditely after you see/hear the notification about a Macro Error, trigger this macro.

WHAT IT DOES:

  1. Gets the last 200 KM Engine log entries
  2. Filters these to remove entries with:
  • "Executing macro"
  • "Running application"
  1. Then displays the last log entry in a very readable format
  2. Provides you with an option to:
  • Edit the Macro with the error
  • Copy the Error info to the Clipboard
  • Open the KM Engine Log File

TAGS: @errors @KM @Macro @Log @JXA

USER SETTINGS:
• Any Action in magenta color is designed to be changed by end-user
• This macro uses Google Search and Google Chrome, but can be easily changed

ACTION COLOR CODES

• To facilitate the reading, customizing, and maintenance of this macro,
key Actions are colored as follows:
• GREEN -- Key Comments designed to highlight main sections of macro
• MAGENTA -- Actions designed to be customized by user
• YELLOW -- Primary Actions (usually the main purpose of the macro)
• ORANGE -- Actions that permanently destroy Varibles or Clipboards

REQUIRES:

(1) Keyboard Maestro Ver 7.2.1+
(2) Yosemite (10.10.5)+

REFERENCES:

  1. KM Forum discussion, 2016-10-15
  1. RegEx Details and Explanation

image

5 Likes

@peternlewis, my macro assumes that all macro errors are logged using the same format. I use this RegEx to parse the log entry:

^([\d-: ]+) (.+)Macro\s‘([^’]+)’ ([\w ]+)\(while executing (.+)\)

Could you please confirm that all macro errors use this format, or, if not, provide the other formats?

If you have any suggestions on how to improve this, I'd love to hear/see them. :smile:

Thanks.

###Example Log Entry

2016-10-27 12:51:12 Search Variable failed to match \d+ Macro ‘KM TEST Notifications’ cancelled (while executing FORCE ERROR to Abort Macro and AutoLog).

From this, I generate this display:

1 Like

I don’t know. Log messages are plain text and could contain anything. There are around 800 places where log messages are printed. Most of them are debugging that is disabled by default. I’ve got no idea what other ones might be of interest I’m afraid, it isn’t something I can support. If it works and finds what you’re after now, that is as good a guarantee as you’re going to get.

Sorry for the bug guys. Hopefully this will fix it.
Please update to this new version.

Thanx for this handy and nifty macro, but the download link still gives version 1.1 instead of version 2.0?

I’m not sure why that happen for you. I just tested it (downloaded it), and it is

~~~ ReleaseNotes for VER: 2.0 2018-03-21 ~~~

BTW, I believe the macro name even change a bit with Ver 2.
Please try again and let us know what happens.

I tried again and it’s working fine. Must have been a user error from this side :wink:
Thanx again for this, I’m positive i’ll be using it a lot.

Thank you!