I wanted to write a script to "push" reminders back by an hour. I came up with this:

tell application "Reminders"
    set c to current date
    set newtime to c + 3600
    set the remind me date of every reminder where completed is false and remind me date < c to newtime
end tell

The script isn't very fast when run from Script Editor (takes a few seconds) but when run from the script menu, it can literally take tens of minutes.

Any insight into why it's so slow?

Looking into this led me to the sqlite database that contains reminders information.

~/Library/Application\ Support/NotificationCenter/(meaningless name).db

It appears to accumulate every reminder ever added... even things like what song played at 4:31pm on January 22, 2015. If Applescript has to iterate though all the entries to find those that match the parameters, it might explain why it's so slow - but it doesn't explain why it's SO MUCH SLOWER when run from the script menu.

I'm wondering if the easiest way to push reminders might not be to manipulate the sqlite database. Thoughts?

  • Don't have an answer for you however I too have seen a substantial time differential between running directly in the AppleScript Editor and from the Script menu in the menu bar for some scripts. I don't have an example at the moment but just wanted to confirm that there can be a substantial time differential. I will add though that in all my many years using AppleScript this has only happened a couple of times and I currently have over 30 script in the menu that I use regularly. The scripts in my menu bar are saved as applications, so I'd expect only a slight differential but not in minutes. – user3439894 Oct 15 '16 at 14:14
  • Running into an issue with osascript on MacOS 10.13.4, but only on a MacBook Pro, not the Mac Mini of the same OS version. In my case, tell application "System Events" is taking EXACTLY two minutes to execute. Still investigating the cause. Have run disk repair to no avail. – tresf Apr 13 '18 at 0:36

You must log in to answer this question.

Browse other questions tagged .