I have a list of repeating events in my Apple calendar that are set to run an AppleScript at certain times. However, if I happen to be away (vacation etc.) then when I switch my Mac back on it runs all the scripts that did not run while the computer was off. Annoying and long.

I tried to use some AppleScript code that checks that the script that wants to run is the one for today and today only (not for the days before etc.), but I could not find a way to discriminate between repeating events: they all have the same properties!

Anyone has a way around? macOS 10.12.4

  • It'd be helpful if you included the applescript code in your question (or, if it's too long, a link to it).
    – Monomeeth
    Apr 7 '17 at 23:07

You can store the date the script was last run and only run your script if the script hasn't already been run today:

property prev_date : ""
set curr_date to date string of (current date)
if prev_date is not curr_date then
  set prev_date to curr_date
  -- your existing code here
end if

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .