Action Timeout Exceeded in Backup Macro

Several of the macros that I've built are exhibiting the same "Action Timeout Exceeded, in macro " " (while executing "Activate "). I use these macros to launch Contacts and Calendar and then to choose the menu that archives the address book or calendars. All of the other functions work perfectly.

The salient points are:
• These macros are all on a timer.
• I have set my screensaver and locking mechanism up so that no unlocking is required.
• When run manually the macros run perfectly.
• I have also watched them run off the timer and they stop while on the timer at the same point. I've watched them run with the screensaver on and off and the display on and off. All results are the same.

For some reason the Action of activating (i.e., launching) the appropriate app seems to hang on that step in all macros. Other conditions, as noted above, seem irrelevant - screensaver, display, etc. To reiterate, running them manually for some reason works without any problem at all.

The Activate Calendar and Activate Contacts actions on all macros are set up to show "Activate Calendar" and "Activate Contacts" as appropriate. "All Windows" is checked. "Reopen Windows" is NOT checked. "If already at the front" option is set to "Leave at the front."

In the options (gear) menu:

Set Action Timeout is set to 20 seconds and "Notify After Timeout" is checked.
"Abort Macro after timeout" is NOT checked.

"Timeout aborts macro" is NOT checked.
"Notify on timeout" is checked.
"Failure aborts macro" is NOT checked.
"Notify on failure" is checked.

I am baffled. Troubleshooting KM macros is usually straightforward but this has me stumped. My thanks in advance to anyone in the community that can assist.

Whilst you have given an excellent description of the problem, can you please post the simplest macro exhibiting this behaviour, this makes it easier for us to troubleshoot the problem for you.

Also what time are you asking them to run or is it every so often.

See on how to do this.

Thanks kindly for your reply. I've tried setting the timer on the macro for various hours; as you'll see in the uploaded (and simplified) version it's currently set for 8:35 PM. I've tried it in early mornings and midday as well and all results are the same.

It is currently set it for 8:35 because at 8:30 I have a macro that shuts down all open applications and reminds me with a notification to get away from my desk and if I'm still there. At that point no apps are open, the screen saver is not running (I have that set for 10 minutes) and even if it was running the screen does not lock when the screensaver starts. I figure this is the best environment in which to launch the macro - screen on and unlocked, no apps running and thus nothing to interfere with the process.

Nonetheless I have programmed in an Escape key in the unlikely event that I've missed something and the screensaver does launch. Also note that I have tried the Action "Stop Screensaver" with the same result.

It is the third Action item, Activate Calendar, that is the problematic step. And, to reiterate, this does not occur when I run it manually - whether by assigning a keystroke or clicking the Run button in the KM Editor window. Somehow, for some reason, doing it triggered by a timer generates that error.

To continue the troubleshooting I've also assigned it to another macro (the end of my "Quit All Open Apps" sequence) in case there was something wrong that would be resolved by having it run as part of a sequence of another macro. The result was the same.

Any suggestions as to why the "Activate Calendar" (or Contacts, as I have a nearly identical macro to back up my contacts to a .abbu archive) causes this error and thus renders the result incomplete, would be gratefully accepted.

Many thanks in advance to anyone devoting their valuable time to helping a fellow KM user. I'm continually impressed by the active community here. Backup Calendar Daily copy.kmmacros (3.9 KB)

what does the shift command g do at the end of your macro?
which osx are you running?

have you looked at the KM Engine log?

The Shift-Command-G Action is the keystroke that allows direct access to any folder on your Mac by entering a path. Once the dialog box is open I enter a path by using the "Enter as text" Action. If you see that dialog box appear then the problematic Action has been accomplished without causing a timeout.

And yes, I have looked at the Engine Log but it shows only the same thing that the Notification shows:

2020-11-08 20:35:00 Execute macro “Backup Calendar Daily” from trigger At 20:35 every day
2020-11-08 20:35:40 Action timeout exceeded. In macro “Backup Calendar Daily” (while executing Activate Calendar).

Thanks for your suggestions. I appreciate the time and effort.

The Activate a Specific Application action waits for the application to come to the front. If the application does not or cannot come to the front, the action will time out.

If the screen is screen saving/locked/sleeping, then the application probably cannot come to the front.

I appreciate your reply, Peter - thank you. I do understand this aspect of the Activate action and that is why I have taken steps to ensure that the screen is awake, unlocked and the screensaver not active prior to that Action being fired. I have watched the macro run when triggered by the timer and the screen does wake up, the screen saver is deactivated and there is another 10 second pause to allow things to "settle down" before the Activate Calendar action triggers.

The result is still the same.

Log the %Application%1% token and see what Keyboard Maestro thinks is the front application.

I appreciate you jumping in to attempt to resolve this but I have no idea what you mean by "Log the %Application%1% token." Sorry but I'll need you to be a bit more specific, please.

Use the Log action, and the Application token to get the name of the application that Keyboard Maestro thinks is at the front.

Alternatively, you can use the Display Text action.

Thanks, but I need one more bit of help... where does that Action get placed? At the top of the macro, just prior to the problematic Action, just after it? Somewhere else?

Thank you.

Immediately before the Activate Application, and then immediately after it (configuring the action to not abort the macro, and following that with a Cancel This Macro action).

Thanks for the specific instructions, Peter. I inserted the Action as you suggested and set the timer to run at 9:35 PM. My standard macro has two 10-second pauses in it (entered in an attempt to allow the system and screen to "settle" before going to the more pertinent Action steps).

The results from the Engine Log indicate that the Calendar was, in fact, seen as the frontmost application:

2020-11-12 21:35:00 Execute macro “Backup Calendar Daily” from trigger At 21:35 every day
2020-11-12 21:35:20 Log: Finder
2020-11-12 21:35:20 Log: Calendar

I had the Cancel This Macro Action installed immediately following the second Log Action so there were no further steps taken after that.

These exact steps, minus the Log steps and Cancel This Macro steps of course, are what are used in the macro that runs normally. Therefore it is clear that the frontmost application both during this test and during the normal running of the macro is the Calendar and yet the error "Action Failed - Action timeout exceeded in macro "Backup Calendar Daily" (while executing Activate Calendar)" still appears.

Do you have any further advice? Thanks in advance for your assistance.

Peter (and other KM readers),

I have resolved this problem. For whatever reason, the "Activate Specific Application" Action was problematic. When I replaced that Action with the "Open a File, Folder or Application" Action everything works as expected. I have tested this by using the Run button in the KM Editor, timers that launched when the screen was in an open/unlocked/normal state and timers that run when by screensaver is on (but does not lock the screen). All work

My thanks to everyone in the community and to Peter for the assistance along the way. We can consider this issue resolved.


1 Like

Congratulations on your excellent diagnosis and problem solving technique
and thanks to Peter for stepping in with his input to help solve this.

If you use the Open a File Folder or Application action to open an application, make sure you explicitly configure the action to open with the Finder. Otherwise you may find the application can be opened with some other application as a document.

Thank you. Yes, I read an earlier post and configured it that way.