Using AppleScript to make daily todos?

Discussion in 'Mac Programming' started by luigidorf, Jan 7, 2012.

  1. luigidorf macrumors newbie

    May 25, 2009
    I've been trying to figure out a way to make todos (reminders) that recur every day (or week). iCal doesn't have this functionality built in, but it seems possible with AppleScript. The problem is, I am clueless when it comes to AppleScript and I can't get anything to work beyond very simple commands.

    If someone has done this, I would be delighted to see the code. I do have some programming experience (mostly C++), so I'm sure if I saw it I would understand it right away.

    I'll say the task seems very simple if I can figure out how to access the data and actions in iCal. Here's some pseudo code for what I'd do:
    if(time = 00:00)
        for(each reminder that I want to recur)
            for(each reminder in iCal)
                if(name of reminder I want to recur = name of reminder in iCal)
                make the reminder I want to recur
    Can anyone help me translate this into AppleScript?

    Thanks in advance!
  2. jiminaus, Jan 7, 2012
    Last edited: Jan 7, 2012

    jiminaus macrumors 65816


    Dec 16, 2010
    Edit: Sorry, you're talking about reminders, not events.

    iCal does have repeating events. At least iCal under Lion does. I can setup an event to repeat every day, every week, every month or every year. Or I can setup a custom repeat and completely control on which days and at what frequency.

    Does this not work for you?
  3. luigidorf thread starter macrumors newbie

    May 25, 2009
    I realize I could just have a separate calendar for reminders, and use events instead, but it wouldn't be the same. Even if the functionality were almost identical, I'd still like to be able to do this in AppleScript so I'll be able to apply what I've learned to other scripts.
  4. subsonix macrumors 68040

    Feb 2, 2008
    Your script will rely on it running constantly in the background, checking if the current time match your events. If your script gets killed you will oversleep so to speak, what if every script that handle timed events would constantly run? It would be a mess. The os provides mechanisms to handle this for you, use them instead. The simplest is to use cron, and create a crontab to launch your script periodically.
  5. luigidorf thread starter macrumors newbie

    May 25, 2009
    I'll look into cron, thanks for that. Still clueless on the AppleScript thing.
  6. sero macrumors member

    Aug 28, 2008
  7. iHutch105 macrumors member

    Aug 8, 2011
    Your pseudo-code suggests that this script will only run at precisely midnight, are you sure that's what you want?

    Also, wouldn't it run multiple times per minute?

    Just a couple of thoughts.

Share This Page