AnsweredAssumed Answered

Apple Script problem.

Question asked by MSpsi on Dec 29, 2009
Latest reply on Dec 31, 2009 by MSpsi

Title

Apple Script problem.

Post

Hello

 

I am having a problem with a Apple Script I wrote.  (Attached at end).  I am using it to send my scheduled appointments to iCal.  It works completely except iCal is not recognizing the time.  It places the appointment at 12am for the day.  ??  

 

I suspect the problem is that the original iCal time stamp is parsed when it enters FM Pro.  Then I paste it back together to send it back to iCal.  I see two potential solutions:

 

I find a way to get iCal to read time or (ironic for a calendar) 

 

OR

 

I get a timestamp to display in a portal (This is why I parsed the incoming time stamp from iCal, it would not display in a portal nor table view in a layout)

 

Any suggestion?

 

FM Pro: 10.0v1

iCal: 4.0.1 (1374)

MacBook OS X 10.6.2 2.26 Ghz Intel Core Duo with 2GB 1067 MHz DDR3 Ram

User level: New

Past experience with Databases

 

Not currently shared or published but plan to do both when solution is complete 

 

--set terms as defined in FM

set theDescription to {}

set theEventTitle to {}

set theCalOld to {}

set theCalNew to {}

set theUID to {}

set theStart to {}

set theEnd to {}

set theStamp to {}

--Get FM Information

tell application "FileMaker Pro"

tell current record

set theDescription to cellValue of cell "__Event ID"

set theEventTitle to cellValue of cell "Event Type"

set theUID to cellValue of cell "UID"

set theCalOld to cellValue of cell "Therapist" & " " & "Open"

set theCalNew to cellValue of cell "Therapist"

set theStart to cellValue of cell "Event Day" & ", " & cellValue of the cell "Event Date" & " " & cellValue of cell "Event sTime"

set theEnd to cellValue of cell "Event Day" & ", " & cellValue of the cell "Event Date" & " " & cellValue of the cell "Event eTime"

end tell

end tell

 

set theStartDateAsText to theStart as text

set theEndDateAsText to theEnd as text

 

-- convert text to dates

set theStart to date theStartDateAsText

set theEnd to date theEndDateAsText

 

--Connect to iCal and Delete old event (apparently you cannot change calendar from within event)

tell application "iCal"

tell calendar theCalOld

delete (the first event whose uid = theUID)

end tell

--Make Event

tell calendar theCalNew

set theEvent to make new event at end of events

tell theEvent

set start date to theStart

set description to theDescription

set summary to theEventTitle

set end date to theEnd

end tell

set theUID to uid of theEvent

show theEvent

end tell

end tell

--Send new UID to FM Event::UID for current record

tell application "FileMaker Pro"

tell current record

set the field "UID" to theUID

end tell

end tell 

Outcomes