4 Replies Latest reply on May 11, 2012 10:43 AM by itsmeisthatu

    Can FMGo make an update to a Calendar?

    ChrisDobbs

      Title

      Can FMGo make an update to a Calendar?

      Post

      Hello,

      I have a FM database on my Mac.  A critical function within it is that it creates entries in iCal via Applescript.

      I now want to use that same database on my iPhone via FMGo.  So, I'd like it to also create entries in the same calendars on the phone (which are, of course, synchronized with iCal).  

      Possible?

      BTW, what is FMGo doing with all calls to run Applescripts?  Just ignoring them?

      Thanks in advance.

        • 1. Re: Can FMGo make an update to a Calendar?
          TSGal

          Chris Dobbs:

          Thank you for your post.

          At the moment, I don't believe Apple has provided an API for Calendar under iOS.  Therefore, FileMaker Go cannot access Calendar.

          Applescript is unavailable on iOS, so FileMaker Go will return an error 3 if you try to run "Perform Applescript" command.  For other unsupported script steps in FileMaker Go, please see pages 27-28 of the FileMaker Go Technical Brief at:

          http://www.filemaker.com/products/filemaker-go/docs/techbrief_filemaker_go_121_en.pdf

          TSGal
          FileMaker, Inc.

          • 2. Re: Can FMGo make an update to a Calendar?
            itsmeisthatu

            i have just started looking into applescripts so that i can send fmp records to ical and would very much appreciatate any steps you have created to assist me with this as i dont understand applescripts at all yet.

            • 3. Re: Can FMGo make an update to a Calendar?
              ChrisDobbs

              Here, this is my routine to create an ical entry from FMP.  Note that there are debug statements commented out; might be handy.  Also, this hints at features (like alarms) that I never used and so probably never debugged.. 

               

              global theCalendar
              global theCalendarTitle
              global theEvent
              global theStatus
              global theAttendee
              global theAlarm
              global allDay
              global tagString
              global theDescription
              global allDescriptions

              tell application "FileMaker Pro"
                  tell current record of document "Apartments.fp7"
                      set dateStartTxt to cell "TimeStampStart"
                      set dateEndTxt to cell "TimeStampEnd"
                      set allDay to cell "All_day"
                      --The above must be TimeStamp fields; construct from Date & Time fields
                      set theSummary to cell "Location" & " " & cell "EventName" & " - " & cell "PersonName"
                      set theDescription to cell "Notes"
                      --set theDescription to "Notes"
                      --set theStatus to cell "Status"
                      set theLocation to cell "Location"
                      set theAttendee to cell "PersonName"
                      set theAlarm to "No"
                      --set theEmail to cell "Email"
                      set theCalendarTitle to "*" & (cell "CalendarName") & " " & (cell "EventName")
                      set tagString to "[DBR" & (cell "CALENDAR_ENTRY_ID") & "]"
                      -- display dialog theSummary & return & theDescription & return & theLocation & return & theCalendarTitle & return & tagString & return & theAlarm
                  end tell
              end tell

              set DateStart to date dateStartTxt
              set DateEnd to date dateEndTxt
                          -- display dialog "dates:  " & DateStart & "..." & DateEnd

              tell application "iCal"
                  
                  -- find the right calendar.  if it doesn't exist, create it.
                  
                  set theCalendar to item 1 of (every calendar whose title is theCalendarTitle)
                  try
                      tell theCalendar
                      end tell
                      on error error_message number error_number
                          --display dialog theSummary & return & theDescription & return & theLocation & return & theCalendarTitle & return & tagString
                          set theCalendar to make new calendar at end of calendars with properties {title:theCalendarTitle}
                  end try
                  
                  tell theCalendar
                      
                      -- in case the event already exists (as tagged by FM), look for it
                      -- if not found, create new event
                      
                      set allDescriptions to (the description of every event of theCalendar)
                      if allDescriptions contains tagString then
                          set theEvent to item 1 of (every event of theCalendar whose description contains tagString)
                      else
                          --display dialog "in else  want to make new event..."
                          set theEvent to make event at end of events of theCalendar
                      end if
                      
                      --display dialog "about to try to tell theEvent..."
                      --display dialog "dates:  " & DateStart & "..." & DateEnd

                      tell theEvent
                          set start date to DateStart
                          set end date to DateEnd + 1
                          set summary to theSummary
                          set location to theLocation
                          set description to theDescription & return & return & "--- do not delete: ---" & return & tagString
                          if allDay is "Yes" then
                              set allday event to true
                          else
                              set allday event to false
                          end if

                          -- display dialog "about to make the alarm..."

                          if theAlarm is "Yes" then
                              make new sound alarm at end with properties {trigger interval:-60}
                          end if

                      end tell
                      
                  end tell
              end tell
              tell application "FileMaker Pro" to activate


              • 4. Re: Can FMGo make an update to a Calendar?
                itsmeisthatu

                thanks for the quick response. i have implemented my changes and it is working. you have saved me alot of time trying to create all that from scratch with no understanding of scripts. however it kinda makes sence when you read the lines. but thank you anyway.

                is there a way to get it to open the calender automatically.

                ical is running in background but i want it to open up when an event is sent.