Using AppleScript to make daily todos?

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

  1. macrumors newbie

    Joined:
    May 25, 2009
    #1
    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:
    Code:
    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)
                    break
                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

    macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    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. thread starter macrumors newbie

    Joined:
    May 25, 2009
    #3
    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. macrumors 68040

    Joined:
    Feb 2, 2008
    #4
    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. thread starter macrumors newbie

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

    Joined:
    Aug 28, 2008
    #6
    are you familiar with remind?
     
  7. macrumors member

    Joined:
    Aug 8, 2011
    #7
    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