Help With "AppleScript AppleEvent timed out. (-1712)" Error

Execute an AppleScript.kmactions (1.6 KB)

The borrowed Applescript above has worked well for a long time to mark targeted Reminders complete until I recently upgraded and now the following error is encountered:

AppleScript AppleEvent timed out. (-1712)

Suspected latest updates include the following:

Anyone else experienced comparable difficulties after these updates or any suggestions to troubleshoot the error?

I’ve run into timeout errors many times when running scripts that contain filtering commands similar to your reminders whose name contains… command. In every case, the problem is that Reminders is ridiculously inefficient at this filtering and that the controlling process—in this case Keyboard Maestro-stops because it’s taking too long.

My workaround is to delete completed reminders. They have a tendency to build up over time and slow down the filtering command (because it searches through all reminders). This is, unfortunately, not helpful if you like to keep completed reminders around as a record of what you’ve done.

drdang,

Thanks for the suggestion! I almost deleted the post because I actually found one case this morning where the Applescript executed successfully without timeout. This made me think there was something particular about the reminder itself instead of a system issue that only appeared to be coincidental with the upgrades.

At any rate, I like and will take your suggestion and try deleting the reminders considering the failure involves a daily recurring reminder where the weekly one from this morning completed successfully.

I still actively use a very old macOS (10.7) where "Calendars" was "iCal" and what is now reminders of "Reminders" used to be the class todo of the class calendar.

Running your script which I adapted returns results blazing fast without any errors. In those days some classes and commands were more lenient towards syntax, that is more natural and not picky about what command you must use with what type of objects.

See for yourself:

However, for the later revisions the same logic doesn't apply. In your case, you would need to plug in a loop as follows:

tell application "Reminders"
   tell account "iCloud"
      tell list "MyList"
         
         repeat with aReminder in (get every reminder whose due date > ThisDate and due date < ThatDate)
            set aReminder's completion date to MyDate
         end repeat
         
      end tell
   end tell
end tell

scrutinizer,

I really like and was interested in your approach, particularly after further thought that deleting my recurring reminders is impractical!

Unfortunately, I'm now experiencing another major issue due to Apple's Reminder app upgrade. I use BusyCal which no longer syncs with Reminders for macOS pre-Catalina and I am unable to upgrade to Catalina due to my use of MS Office 2011 (no longer supported) and my VBAs (unless rewritten). The new Reminders app has removed all my ToDos from iCloud and moved them to a new storage format which only syncs with iOS 13+ and macOS Catalina and above. :scream: :confounded:

Even if Catalina upgraded the format of your reminders then it should be irrelevant for AppleScript because hopefully, Apple has updated its AppleScript dictionary to reflect the changes. I run 3 macOS: 2 of them have Reminders.app and their AppleScript Dictionaries are identical. I don't run Catalina since the newest of my used macOS is Mojave where nothing has changed in terms of the object model manipulation since Reminders was first introduced and todos were removed from Calendars to which iCal was renamed.
My advice would be to review Reminders AppleScript Dictionary, particularly its hierarchy: its Dictionary is pretty basic. Also, you can inspect the elements by repeatedly issuing the get command.

Bear in mind that the new syntax for Reminders and other apps in AppleScript language versions (not to be confused with AppleScript Editor application versions) newer than 2.2.1 doesn't accept the reference to list as a whole as in set completion date of (every reminder whose ...) to, in operations with applications' objects, requires processing them one by one.