« Subversion | Main | Mute/unmute the sound »
Friday
Oct282005

AppleScript, Export iCal Birthdays to Remind


Another AppleScript to export all Birthdays from iCal to remind-formated text file:

property reminders_path : POSIX path of ((path to home folder) as text) & "Reminders/Birthdays.txt"
property days_in_advance : 7 -- how many days in advance to remind
tell application "iCal"
do shell script "mv " & reminders_path & " " & reminders_path & ".bak"
set this_calendar to first calendar whose title contains "Birthdays"
repeat with this_event in every event of this_calendar
tell this_event
set es to summary as string
set n to offset of "’" in es
set l to length of es
set event_summary to (text 1 thru (n - 1) of es) & "'" & (text (n + 1) thru l of es)
set start_date to start date
set date_string to (((month of start_date) as string) & " " & (day of start_date) as string)
set reminder_string to date_string & " +" & days_in_advance & " MSG " & event_summary & " %b.%"
do shell script "echo \"REM " & reminder_string & "\" >> " & reminders_path
end tell
end repeat
end tell


Make sure to update reminders_path and days_in_advance properties according to your situation and/or liking.


P.S. I promise it's the last one. At least for a little while.


PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>