Macro cancelled — timeout exceeded

I upgraded to v11.0.4 today. The launcher macro for Calendar works, but after about 20 seconds, a popup appears in the top right corner of the screen. It says

Macro Cancelled
Action 22542 timeout exceeded. Macro
"Launch Calendar" cancelled (when
executing Activate Calendar).

It's just got a hot key defined (option-shift-G), and it says to Activate Calendar, All Windows, and if already at the front, leave it at the front. Same as my other launchers, all of which work fine.

Any idea what's wrong?

thanks

If that happened to me, the first thing I would do is re-create the macro from scratch, after deleting it. That's because it sounds like the issue might be a bad pointer in the macro to the app. There's only a 10% chance that it will fix the problem, but if you have 30 seconds free, give it a shot.

I had tried copying a different launcher and changing it, but that didn't work. I tried your suggestion, and … it was in the 90% probability, not the 10%. Didn't work. Thanks for the idea, though.

Ok. It's your choice. However "copying and changing" doesn't sound like "deleting and re-creating."

Sorry, when I wrote "I tried your suggestion", I meant literally that I tried it, after doing the copy/modify. Redoing it didn't work.

Probably best to show your macro in case anyone sees something. It's easily done by selecting the Macro then using Edit > Copy As > Copy As Image and then pasting into a Reply box here.

Thanks. I looked for an Insert image feature here, but didn't see it. Turns out just pasting works!

I'm not certain why that notification is appearing. But you can at least disable the notification by selecting the gear icon (far to the right of where it says Activate Calendar) and unchecking the option for Notify On Timeout.

This will happen if Calendar does not come to the front.

The action basically does something like this:

  • Ask the system to activate Calendar
  • Wait until Calendar comes to the front

With a 20 second timeout by default on the action.

So if for any reason Calendar cannot come to the front, that will cause the abort to happen.

It does come to the front, but the message still appears.

What I would do in your situation is create a new macro which triggers when Calendar becomes the front application, and what the macro would do is make a beep or say "Calendar is at the front."

You can do whatever you want, but that's how I would prove to myself and others that it really is at the front. Since we can't see your screen, providing this information could be persuasive.

Does KME check for the frontmost app, or does it rely on the OS "telling" it?

What happens if you run this?

Open Calendar.kmmacros (2.9 KB)

Image

1 Like

If I use that test macro, I still get a popup, but also a text box:

Turning off the warning, as someone suggested, does help.

Then, for whatever reason, KM can't tell that Calendar is the frontmost app. This isn't a particular 11.0.4 problem, as the same actions work fine for me in the new version of KM (macOS 15.4.1 on Intel, for this machine).

You could troubleshoot further, perhaps use an AppleScript action to activate Calendar instead, but I'd be inclined to set the "Activate" action's timeout to the longest time you think it'll take to launch the app plus a second or two (if your macro does things after it activates Calendar), turn off failure Notifications and Aborts, and trust to luck :wink:

Check the application selection - it is possible that Calendar moved location (due to system changes), and that your action is referencing it at the old location and thus that old one is never coming to the front.

I used Other… to select the Calendar app explicitly. Still happens.

I also notice that when I press CMD+N with Calendar showing, I get a window for a new email message, even if Mail hidden. I do have a CMD+N macro in Mail, but it requires that Mail be at front.

If I turn of KM, none of this happens.

This problem started with the latest update to KM the other day.

I do have some problems where other utilities like this seem to cause problems. When I have Typinator running, for example, I sometimes get "Â" at the start of a new item in Messages.

But turning off the timeout fixes the message popup, so I'm going to go with that for now.

Check the log for what macros are triggering.

I have no real idea what you mean by a “window for a new email message”, so clearly something else is going on.

My guess (I could be wrong) is that when you say "with Calendar showing", what you mean is the Calendar window is showing, but my guess is that the name of the app in the system menu at the top left corner of the screen is still "Mail". This is a common problem in macOS where the frontmost app often doesn't have any window showing, and yet it is still the frontmost app and that causes great confusion among users. In this situation KM recognizes Mail as the frontmost app, even when Calendar is the frontmost window.

If I'm correct, it will be an easy thing to fix, but let me know if I'm correct.

To be clear... Are you saying that "if Keyboard Maestro (or any app except Calendar) is frontmost and I run this macro, Calendar is activated correctly and the "named menu" next to the Apple menu becomes "Calendar" but the action times out and the macro aborts"?

If that's the case then KM can target Calendar correctly -- otherwise Calendar wouldn't activate. But even though Calendar is now frontmost KM can't detect that (also evidenced by the "Display Text" in your earlier screenshot).

You could try running the following in Script Editor, with Calendar open but Script Editor frontmost:

with timeout of 1 second
   tell application "Calendar" to activate
end timeout

...and seeing if you get a similar timeout error.

Answer: Yes.

Answer: I could, but I'd have to learn the Script Editor, which I don't want to do right now.

And to answer Peter: If Mail is the frontmost app, and I press the key sequence to surface Calendar, Calendar appears. But when I press CMD+N, I get a blank new-message window from Mail. It's as if Mail is at the front. Like this:

And this all started when I upgraded to the latest version KM a week or two ago.

Thanks for all the advice, but I guess I'll have to live with it for now.