AnsweredAssumed Answered

Send appointment to iCal applescript

Question asked by garywatson on Dec 16, 2015
Latest reply on Dec 16, 2015 by electon

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"

 

  activate

 

  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

 

  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

Outcomes