Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Steiner

macrumors newbie
Original poster
Oct 24, 2006
5
0
South of England
I am using Filemaker 8.5 and would like to export field content to iCal.

I have all the fields working except for the attendees (1 result string and not Multiple people).

Does anyone know why I can not set the attendees in iCal through the following apple script?

-- grab the data from Filemaker
tell application "FileMaker Pro"
tell current record
set theCalendarTitle to cellValue of cell "iCal Calender"
set theSummary to cellValue of cell "iCal Summary"
set theDescription to cellValue of cell "iCal Description"
set theStartDate to cellValue of cell "iCal Start Date"
set theStartTime to cellValue of cell "iCal Start Time"
set theEndDate to cellValue of cell "iCal End Date"
set theEndTime to cellValue of cell "iCal End Time"
set theLocation to cellValue of cell "iCal Location"
set theAttendees to cellValue of cell "Full Name"
end tell
end tell

set theStartDateAsText to theStartDate & " " & theStartTime as text
set theEndDateAsText to theEndDate & " " & theEndTime as text

-- 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 with properties {start date:theStartDate, end date:theEndDate, summary:theSummary, description:theDescription, location:theLocation, attendees:theAttendees})
show theEvent

end tell


:confused: :confused:
 
Those other fields are mostly strings or dates, but for attendees iCal uses a list of "attendee" objects, so you need to directly create one for each attendee. For example:

Code:
set theEvent to (make event at end of events of theCalendarNumber with properties {start date:theStartDate, end date:theEndDate, summary:theSummary, description:theDescription, location:theLocation})
tell theEvent to make new attendee at beginning of attendees with properties {display name:theAttendees}

If theAttendees stores a list of names, you'd need to do some string manipulation first and then create multiple attendees.

For reference, here's the properties in the attendee class, if you want to add some details:

display name (Unicode text, r/o) : The first and last name of the attendee.
email (Unicode text, r/o) : e-mail of the attendee.
participation status (unknown/accepted/declined/undecided) : The invitation status for the attendee.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.