Can't Read AppleScript Error Message Because It's Cut Off

I am trying out the script posted here: From TextExpander to Keyboard Maestro… again - All this

When I run the macro in KM 9.2 on High Sierra, I get an error msg displayed by the system:

Now, how can I get the full error message? Clicking on it will not help (Peter: Couldn't you have the Notification handler of KM then display its own error dialog with the full message here?)

I read the docs on this topic but found no mentioning on how to deal with Applescript errors: action:Execute an AppleScript [Keyboard Maestro Wiki]

1 Like

I figured out the issue that was causing the error by running the script in Script Debugger (I had missed to create a "Snippet - Temporary" group), but that doesn't solve the general problem of getting these cut-off error messages whenever there's an error in a script.

You can find the full message in the KM log file. AppleScript errors are down to AppleScript and not KM. so if you have an error in your AS you need to explore the AS documentation rather than the KM documents.

Thank you.

Could someone with write access to the Docs Wiki please add this important information to the Wiki article at action:Execute an AppleScript [Keyboard Maestro Wiki] ?

You might add your request to the Wiki category in this forum.

Thomas, exactly what would you like to see in the KM Wiki?

Also, you may find this helpful:
MACRO: Display Last KM Macro Error Ver 4 [Pub]

Hi JM,
how about a section titled "Error Handling", with text:

If the Applescript contains errors, a system notification will be displayed when the action is run (unless you have disabled them in System Preferences).

If a Notifications is displayed, it can happen the error message gets cut off.

To see the entire message, look into the log, which you can view by ...

Actually, I have trouble finding the log that would show me the applescript error. When I search for "log" in the Help menu, I only find Actions related to the log, but no command to actually view a log window or a log file.

1 Like

(sorry, this was meant to be a reply to @JMichaelTX)

Here's another example why finding the log file isn't as easy as you made it sound.

When I use the menu entry for "Log Help", I see a Wiki page that mentions a "Keyboard Maestro Engine.log" file.

But there is no such file on my startup disk:

Also, since it's a Wiki, ideally, the mentioning of the Log file should be using a hyperlink to the actual page describing the log file.

I'd just as well complete the Wiki pages myself, but, alas, I have no write access.

Okay, so I now noticed the menu entry "Open Logs Folder" in the Help menu. The fact that searching for "log" or "logs" in the Help's search didn't reveal this can be written off as another bug in macOS, I guess.

And therein I found "Engine.log", with the Applescript errors I was looking for.

So, the Applescript Wiki page should probably point to this file, with the hint that using the "Open Logs Folder" in the Help menu will show that file.

Thanks Thomas. I have updated the KM Wiki per your suggestions. Please let me know if you have any further suggestions.

Execute an AppleScript: Error Handling

2 Likes

Hey Thomas,

You can grab the bottom of the notification and drag it down to reveal more of the message.

That is not a good solution, but sometimes it's adequate.

JM's last error macro is more sophisticated than my solution, but here it is for what it's worth.

-Chris

4 Likes

Chris and @Thomas_Tempelmann:

FYI, my macro provides an option to open the KM Log in BBEdit:

Don't let this answer slip by.

IMO It is the answer and completely non-obvious. It took me forever to learn this.

@Thomas_Tempelmann , would you consider tagging this as the solution?

4 Likes