Applescript Filemaker - > Ical with reoccuring date of birth

hi all, I am working on an applescript in Filemaker to automatically add a contact’s birthday to iCal. It works up to creating the date as a new event in Ical but I’m not sure how to add a repeat every year step. Quite important, otherwise all it does is create one date in your calendar, which might be in the 1980s for example.

thanks for any ideas!

-- grab the data from Filemaker
tell application "FileMaker Pro"
    tell current record
set theCalendarTitle to cellValue of cell "Birthdays"
set theSummary to cellValue of cell "FULL NAME"
set theStartDate to cellValue of cell "Date of Birth"
set theEndDate to cellValue of cell "Date of Birth"
set theAllDay to cellValue of cell "All Day for Birthday Calendar"
set theRecurrence to cellValue of cell "Repeat"
end tell
end tell
 
set theStartDateAsText to theStartDate 
set theEndDateAsText to theEndDate 
 
-- convert text to dates
set theStartDate to date theStartDateAsText
set theEndDate to date theEndDateAsText
 
-- create the event in iCal
tell application "iCal"
    activate
   
    -- make new calendar if need be
    set allCalendarTitles to the title of every calendar
    if allCalendarTitles contains theCalendarTitle then
        set theCalendarNumber to (first calendar whose title is theCalendarTitle)
    else
        set theCalendarNumber to (make calendar at end of calendars with properties {title:theCalendarTitle})
    end if
   
    -- make event
    set theEvent to make event at end of events of theCalendarNumber
   
    -- set the event properties
    tell theEvent
        set start date to theStartDate
        set end date to theEndDate
set recurrenceDate to theStartDate
set summary to theSummary
if theAllDay = "1" then
            set allday event to true
        end if
set recurrence to theRecurrence
end tell
    show theEvent
end tell


You may look at Shane Stanley’s CalendarLib available at :
http://www.macosxautomation.com/applescript/apps/Script_Libs.html

It helped several users wanting to dive Calendar.app.

Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) vendredi 29 juillet 2016 16:52:53

-- tell application "FileMaker Pro"
	tell current record

set theCalendarTitle to cellValue of cell "Birthdays"
set theSummary to cellValue of cell "FULL NAME"
set theStartDate to cellValue of cell "Date of Birth"
set theEndDate to cellValue of cell "Date of Birth"
set theRecurrence to cellValue of cell "Repeat"
set theAllday to cellValue of cell "All Day for Birthday Calendar"

end tell

-- end tell

-- convert text to dates

set theStartDate to date theStartDate
set theEndDate to date theEndDate

tell application "iCal"
	activate
	
	-- make new calendar if need be
	set allCalendarTitles to the title of every calendar
	if allCalendarTitles contains theCalendarTitle then
		set theCalendarNumber to (first calendar whose title is theCalendarTitle)
	else
		set theCalendarNumber to (make calendar at end of calendars with properties {title:theCalendarTitle, color:theColor})
	end if
	
	-- make event
	set theEvent to (make event at end of events of theCalendarNumber with properties {start date:theStartDate, end date:theEndDate, summary:theSummary, recurrence:theRecurrence})
	
	tell theEvent
		if theAllday is "1" then
			set allday event to true
		end if
	end tell
	show theEvent
	end tell