5 Replies Latest reply on Jan 11, 2010 2:54 PM by one9lbhammer

    Simple Script for iCal?



      Simple Script for iCal?


      Filemaker Pro 10

      Mac OSX 10.5.8

      Moderate Skill


      I'm looking for a simple script to send events to  iCal.  All I need is to be able to send one field at a time to one date at a time.  Any help would be appreciated! 

        • 1. Re: Simple Script for iCal?
          • 2. Re: Simple Script for iCal?
               I've tried this script and several variations thereof to no avail.
            • 3. Re: Simple Script for iCal?



              Thank you for your post.


              Which script did you use?  The following link looked straight-forward and complete:





              FileMaker, Inc. 

              • 4. Re: Simple Script for iCal?
                This is a piece of a rather involved FileMaker to iCal example I once made; but never really used in production, nor distributed (because I did not want to have to support it, as changes happen). But if you just need to send an Event, it should work:
                global fmDateTxt
                global dateStamp
                global FM_UIDs
                global FM_DateStamp
                global fmUID
                global theUIDs
                global theEvent
                global theAttendee
                global theEmail
                global theStatus
                global theCount
                property calTitle : "Home"
                global theCalendar
                property theAttendee : ""
                property Desc : ""
                global Alarm_flag
                global Alarm_interval
                my FM_to_iCal_event()
                on FM_to_iCal_event()
                tell application "FileMaker Pro Advanced"
                tell current record of window 1
                set dateStartTxt to cell "_cTimeStampStart"
                set dateEndTxt to cell "_cTimeStampEnd"
                set theSummary to cell "EventName"
                set theStatus to cell "Status"
                set theLocation to cell "Location"
                set Desc to cell "Notes"
                set theAttendee to cell "Client"
                set theEmail to cell "Email"
                set Alarm_flag to cell "Alarm_flag"
                set Alarm_interval to cell "Alarm_interval"
                set theCalendar to cell "CalendarName"
                set theUID to cell "UID"
                end tell
                end tell
                set DateStart to date dateStartTxt
                set DateEnd to date dateEndTxt
                tell application "iCal"
                set theCalendar to item 1 of (every calendar whose title is calTitle)
                tell theCalendar
                set theEvent to get item 1 of (every event whose uid is theUID)
                tell theEvent
                set start date to DateStart
                set end date to DateEnd
                set summary to theSummary
                set location to theLocation
                set description to Desc
                set allday event to false
                my set_status(theStatus)
                --set recurrence to "FREQ=DAILY;INTERVAL=2;UNTIL=20040531T035959Z"
                if theAttendee is not "" then
                if exists attendee 1 then
                set display name of attendee 1 to theAttendee
                set email of attendee 1 to theEmail
                --end try
                make new attendee at beginning of attendees with properties {display name:theAttendee, email:theEmail}
                --end try
                end if
                end if
                if Alarm_flag = "1" then
                make new display alarm at end of display alarms of theEvent with properties {trigger interval:Alarm_interval}
                end if
                set theStampDate to stamp date of theEvent
                end tell
                end tell
                end tell
                set FM_DateStamp to my make_FM_date(theStampDate)
                tell application "FileMaker Pro Advanced"
                tell current record of window 1
                set cell "iCalStampDateTxt" to FM_DateStamp
                end tell
                end tell
                end FM_to_iCal_event
                on set_status(theStatus)
                tell application "iCal"
                tell theCalendar
                tell theEvent
                if theStatus is "None" then
                set status to none
                if theStatus is "Tentative" then
                set status to tentative
                if theStatus is "Confirmed" then
                set status to confirmed
                if theStatus is "Cancelled" then
                set status to cancelled
                end if
                end if
                end if
                end if
                end tell
                end tell
                end tell
                end set_status
                on make_FM_date(dateStamp)
                set Yr to year of dateStamp
                set Mn to month of dateStamp as number
                set Dy to day of dateStamp
                set dateTxt to (Mn & "/" & Dy & "/" & Yr) as string
                set timeTxt to (time string of dateStamp)
                set dateTimeTxt to (dateTxt & " " & timeTxt) as string
                --FileMaker TimeStamp
                return dateTimeTxt
                end make_FM_date
                • 5. Re: Simple Script for iCal?

                  Alright, this weekend I adjusted Jonathon Stark's script




                  to work to send events to my iCal with a script trigger and it works perfectly.  I started another post this morning asking for help getting this to work cross platform on the Vista machine (Outlook Calendar) that uses this database remotely.  I have a sync between my iCal and the Outlook calendar on the Vista machine through a Google Calendar, but I can't figure out how to get dates to the Outlook Calendar from the Vista machine. 


                  If there is a way to change the file path so that the PC can send the dates directly to the iCal on the Mac that would be acceptable as well.


                  This forum has helped me at every turn and I have the utmost faith that you wonderful folks will do so again.  Thanks in advance, and sorry for the double post! I know that's taboo, but I honestly forgot about this thread until I was looking for responses to what I posted this morning.