1 Reply Latest reply on Dec 16, 2015 3:16 PM by electon

    Send appointment to iCal applescript


      I am trying to send an appointment name, date, start time and end time from my current record in FM Pro Advanced to iCal. I can get the appointment created in calendar with the correct name and date but there is no start time or end time. What am I doing wrong? Below is the applescript I am using


      tell application "FileMaker Pro Advanced"


        tell current record


        set theCalendarTitle to "Work"


        set theSummary to cellValue of cell "Name"


        set theStartDate to cellValue of cell "Date"


        set theStartTime to cellValue of cell "Time1"


        set theEndDate to cellValue of cell "Date"


        set theEndTime to cellValue of cell "Time2"


        set theAllDay to "0"


        end tell


      end tell


      set theStartDateAsText to theStartDate & " " & theStartTime as text


      set theEndDateAsText to theEndDate & " " & theEndTime as text


      set theStartDate to date theStartDateAsText


      set theEndDate to date theEndDateAsText



      tell application "Calendar"




        set allCalendarTitles to the title of every calendar


        if allCalendarTitles contains theCalendarTitle then


        set theCalendarNumber to (first calendar whose title is theCalendarTitle)




        set theCalendarNumber to (make calendar at end of calendars with properties {title:theCalendarTitle})


        end if


        set theEvent to make event at end of events of theCalendarNumber



        tell theEvent


        set start date to theStartDate


        set end date to theEndDate


        set summary to theSummary


        end tell


        show theEvent



      end tell

        • 1. Re: Send appointment to iCal applescript

          If the date itself works then there may be something wrong with the time format.

          AppleScript isn't complaining about errors?

          Try to debug this in ScriptEditor or place a display dialog (theStartDate), or for theEndDate just after they're set.

          This way you can see if the dates are formatted properly.


          For this I use a calculated AppleScript and first get the values into local variables so I can debug easier:

          I think you can deduct how the $variables get there...


          List (


          "tell application \"Calendar\"";

          "set eventStart to date (" & $start & ")" ;

          "set eventEnd to date (" & $end & ")";

          "set eventTitle to " & $title;

          "set eventLocation to " & $location;

          "set eventSummary to " & $summary;

          "set eventUrl to " & $url;

          "tell calendar " & $calendar ;

          "set theEvent to make new event with properties {summary:eventTitle, description:eventSummary, location:eventLocation, start date:eventStart, end date:eventEnd, url:eventUrl}";

          "set eventId to uid of theEvent";

          "end tell";

          "end tell";

          "tell me";


          "set cell " & $iCalEventIdFieldName & " of current record to eventId";

          "end tell";

          "on error errorMsg";

          "display dialog errorMsg";

          "end try"



          This script also gets you back the event uid and places it back into the table so I can track it back later.

          It requiers an extra field in your table that you set with GetFieldName ( your table::iCalUIDField ).