I'm getting a bit frustrated with this, because my macro is super simple.
I have a main macro with lots of different actions that gets triggered every morning at 6am, when I'm still asleep. It starts with a simple Wake Screen, because some actions and macros I trigger need the screen to be visible to click found images.
When it gets close to the very end, I have this macro I trigger to backup Calendar and Contacts, which starts with a simple Activate Calendar, but it has been quite frequent that this simple action is causing everything to stop working.
I can see that the macro to backup my Reminders, is working, but then the macro to backup calendar and reminders. It always gets stuck on the simple Activate Calendar action.
Any tips? I can always move those actions from the main macro to a dedicated macro, but I'm still curious to know what could be causing this, if everything seems to be set up properly and it's just this simple action that's collapsing?
This really shouldn't do anything different than the Activate action you're using, but what if (as a test) you replace it with a Shell Script action. Use this version for newer macOS releases (sadly, I don't remember when this change happened):
open -a /System/Applications/Calendar.app
Or on older macOSes:
open -a /Applications/Calendar.app
I would expect the same problems you're already seeing, but maybe this triggers some different launch mechanism and it'll work? Total shot in the dark, though...
I don't think the issue is with the action itself, because I have it for other macros and it works.
I believe the issue is probably this Applescript action to backup my Apple Reminders and it usually takes like 5 minutes or so to complete. That action is right before the macro to Activate Calendar, and maybe it creates some kind of issue? Who knows...?
So, I reorganized things and I let that Reminders action run at the very end. Today, at least, no errors. I will see how it goes from now on.
If that fails for some reason, I will try your approach. Thank you! I agree that it shouldn't make a difference, but at this point in my life, I believe that everything can always make a difference, even when it seems to make no sense
Maybe your computer does not like getting up that early , change it to 06:05?
If it is still failing, consider setting the relevant KM actions to continue and not abort the whole macro. Also check the engine log for any other clues.
Consider moving it to its own macro with a slightly different time trigger ?
Unfortunately the log doesn't share much information about this. It just shows that it failed.
Yes, that's another option. I wanted to keep everything inside a single macro, just to make it more organized, and I also have other macros in the root of the macro group, so I will see how it goes now that I changed it. If it doesn't fix it, I will definitely consider having a separate macro set to a different trigger time.
We certainly won't until you show us the AppleScript! But a script that only targets Reminders shouldn't block a simple Calendar activation. If you think it does then make sure the "Execute Macro 'Backup Reminders'" action is executing synchronously, so it completes before you move on to the Calendar macro.
Have you checked it's that action you show that is being cancelled? You've an action ID in the Notification, so it's easy to make sure. And if it is then the position in the Notification list is another nod to async ops causing problems.
You must either make sure async threads are totally independent of each other, or get heavily into semaphore locks to ensure order of operations and/or prevent contention for shared resources.
Does Calendar need to be frontmost? If not, try @griffman's fix -- the KM action won't complete, and will ultimately time out, if Calendar can't be brought to the front for any reason. If it just needs to be open, don't front it.