AnsweredAssumed Answered

Mountain Lion and applescripts

Question asked by itsmeisthatu on Jul 30, 2012

Title

Mountain Lion and applescripts

Post

I have been running FMP 11 adv on a mac running Lion, using applescripts to send events to ical. all ok.

i have just upgraded to Mountain Lion and the applescripts to send events to ical are no longer working.

i have tried reading all forum posts about how to sort this out here and elsewhere but nothing is working.

Please help.

 

here is the script that worked on Lion

global calName
global theCalendar
global theEvent
global theStatus
global theAttendee


tell application "FileMaker Pro Advanced"
     tell current record of document "my database.fp7"
          set dateStartTxt to cell "date booked"
          set dateEndTxt to cell "date booked"
          --The above must be TimeStamp fields; construct from Date & Time fields 
          set theSummary to cell "job type" & " " & cell "Title" & " " & cell "Last Name" & " " & cell "time" & " " & cell "call first" & " " & cell "std" & cell "phone number" & " " & cell "mobile number" & " Order " & cell "aa order"
          set theStatus to cell "Call First"
          set theLocation to cell "house no." & " " & cell "address 1" & " " & cell "Address 2" & " " & cell "address 3" & " " & cell "city" & " " & cell "Post code"
          set thedescription to cell "notes"
     end tell
end tell

set DateStart to date dateStartTxt
set DateEnd to date dateEndTxt

tell application "iCal"
     activate
     set visible of window "iCal" to true
end tell

tell application "iCal"
     set theCalendar to item 1 of (every calendar whose title is "work")
     tell theCalendar
          set theEvent to make new event at end of events
          tell theEvent
               set start date to DateStart
               set end date to DateEnd
               set summary to theSummary
               set location to theLocation
               set description to thedescription
               set allday event to false
               my set_status(theStatus)
          end tell
     end tell
end tell


on set_status(theStatus)
     tell application "iCal"
          tell theCalendar
               tell theEvent
                    if theStatus is "None" then
                         set status to none
                    else
                         if theStatus is "Tentative" then
                              set status to tentative
                         else
                              if theStatus is "Confirmed" then
                                   set status to confirmed
                              else
                                   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

Outcomes