If there is an error running a macro, the first part of the error message is shown in a macOS notification. That notification has a 'Show' button which looks like it should show the rest of the error message - but when I click it nothing happens. Should it do something?
I never thought to ask myself that question, I just presumed there's a reason, probably a macOS limitation. No doubt someone here will give you the correct answer.
But if you want to know how to fix the programming error you are having, it would help a lot if you surrounded the Search action (the one that caused this error) inside a Try statement, like this:
This way you would see the string (which I'm guessing is VarName, but is probably something else) and you would get a pop-up asking if you wanted to continue or stop.
Thanks @Airy that's a useful tip! I can also call up the logs - it just seems like the 'show' button would call them up automatically. A bit odd that the button is there if it doesn't do anything
Well, hopefully @peternlewis knows the answer to that :). My guess is that maybe it's a button from a default notification, and what it would "show" is the full notification, which you're seeing already? The help page for Notifications doesn't include any details about the Show button.
-rob.
Unfortunately, notifications are under your control (for better or worse, worse in this case), not Keyboard Maestro’s control. You choose the style in your system settings, Notification settings. And it cannot vary for different notifications within the same application (unless you're Apple of course). As such, Keyboard Maestro cannot assume the button will even be there so it doesn't do anything cuz it isn't normally there.
Worse, if you turn off the notifications (which is very easy to do when you first start using Keyboard Maestro), then the errors wont even show up.
It's almost time to resurrect Growl
and write my own notification system.
Thanks Peter. Are you saying I should have my notifications set differently for Keyboard Maestro? I can't see any option that would turn on and off the 'show' button.
Yes, they should be set to Banner, not Alert.
Hmmm, it was already set to banner... I'll try turning notifications off and on again for KM and KM Engine.
I take it this doesn't matter much - the error message would still be truncated if the Show button wasn't there?
Correct. The Engine.log file will show the whole error.
For those who want more information from their error messages, here's a simple macro that fully displays the last ten lines in the Engine.log file that contain the word "failed" or "error".
Execute a Shell Script Action (v11.0.2)
Execute a Shell Script.kmactions (1.0 KB)
Thanks. I've just spent the last couple of hours coming up with an even more interesting utility for examining any log files. But I may test it for a few days before posting it, probably in its own thread.
At one point, @_jims had the same thought, and he created a comprehensive engine log analysis macro. Here's how Jim describes its main feature:
You can also use it to trim entries from your log based on a number of conditions. If you write complicated macros, I highly recommend it to make debugging a bit easier.
-rob.
I just reviewed that post. I hadn't seen it before. His solution is very powerful. Mine has only a subset of those features. Still, I may post my solution since it uses some interesting techniques. Also, sometimes it's just interesting seeing other people's solutions to the same problems.
I would encourage you to post it—more is never enough when it comes to ways to use Keyboard Maestro :).
-rob.
Thanks for the positive feedback. I think I will post it, but in its own thread.
I still consider myself a pretty new user to KM, and I have to ask, is there nothing that can be done to improve the error reporting experience? Here are some ideas:
- Make clicking the notification open KM, potentially suggesting the user look at the log file, or reveal the log file, or open the log file either natively or in Console
- If none of those is possible, omit the functionless and deceptive "Show" button
- Within the error message, name the macro associated with the failure:
- In the notification
- In the log
- Mention the existence of the log file in the Troubleshooting page of the manual
For (1) I've been able to make notifications that open apps using terminal-notifier
, and have seen plenty of apps that not only open, but select the relevant item when you click a notification. Surely, something more than a no-op is possible for KM? (For all its problems, I have to give Shortcuts credit on this — its notifications take you not just to the shortcut that failed, but to the step that failed, and the full error is displayed atop the step.)
For (2), it isn't currently possible to know which macro failed. You can make a guess based on line proximity and timestamps, but the Action
lines do not name it, so if you have multiple similar macros running at the same time, you can't be sure.
For (3), I think experienced users may have forgotten that new users don't already know their way around all the facets of KM. I only learned of the log thanks to this thread.
Hope this all can be improved
These things are controlled by your Notifications settings.
It should generally be set to Banners, not Alerts so that it does not have the functionless and deceptive "Show" button
which isn't meant to be there, but Apple does not let the application control how the notification is displayed.
It is if the macro is canceled.
It is, in the Troubleshooting [Keyboard Maestro Wiki], but not in the User Manual which is a much more abridged version so it is not appropriate there.
Unfortunately, Apple control the display of Notifications, and only one style of notification can be selected per application (unless you are Apple of course). And Apple only allow the user to select the style. So for a lot of people it's worse than the functionless and deceptive "Show" button
- the system has helpfully turned off notifications so they don't even see the error at all.