Updating an iCal Event from FileMaker via AS

Hello,

I have a script in my FM solution that creates events in iCal.
I’d like to update the event once it’s created.

I may add notes or change the start/end time of the event in Filemaker and would like to update the existing
event in iCal.

so far I’ve managed to get the specific event with:

tell application "iCal"
	set startTS to date "Sunday, June 14, 2009 4:00:00 PM"
	set sumText to "theSummaryText"
	
	tell calendar "Travel"
		set e to events whose start date is equal to startTS and summary is equal to sumText
	end tell
	
end tell

But my attempts to update the event have all failed.
Maybe the way to go is delete the event and re-create with all new info?

Thanks in advance!

Vincent

Hi, Vincent.

Using ‘events’ (or any plural keyword) normally returns a list, even if there’s only one event in it. Maybe you’ve been trying to modify the list instead of the event. Try changing ‘events’ to ‘first event’.

NG - that got me going in the right direction

using events does return a list
so I set theEvent to the last item in the list ( even thought it only returns one item)
and used Move to move it to a different calendar.

This sort of worked but not as expected, the event gets copied to the different calendar leaving the original event in the calendar where it was. Some times it looks as if it worked but after refreshing the calendar the you will see the duplicate events.

Anybody else experience this behavior with the move command ?


tell application "iCal"
   set startTS to date "Sunday, June 14, 2009 4:00:00 PM"
   set sumText to "theSummaryText"
   
   tell calendar "Travel"
       set e to events whose start date is equal to startTS and summary is equal to sumText
   end tell
   

    set theEvnt to last item in e
    move theEvent to end of calendar aDifferentCalendar


end tell

Your code works fine for me, although the syntax would usually be to move an object to the end of similar objects at the destination, like this:

If the event’s staying in the source calendar, maybe the calendar’s not editable for some reason. :confused:

I tried your code and I still end up with two events. At first it seems it worked but after toggling the show calendar buttons the duplicate appears. I tried this with different calendars, same result.

Also the two events end up with the same unique ID so deleting one will also delete the other.

Maybe a bug?

Thanks
V