Mac Using AppleScript to make daily todos?

luigidorf

macrumors newbie
Original poster
May 25, 2009
27
0
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!
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
0
Sydney
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?
 
Last edited:

luigidorf

macrumors newbie
Original poster
May 25, 2009
27
0
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?
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.
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
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.
 

luigidorf

macrumors newbie
Original poster
May 25, 2009
27
0
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.
I'll look into cron, thanks for that. Still clueless on the AppleScript thing.
 

iHutch105

macrumors member
Aug 8, 2011
48
0
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.