Change event's calendar

Hy to everyone, I’m new in the forum and a new dummy AppleScript user.
I’ve successfully created new events in mac via FileMaker’s “execute applescript” function and I can also reveal each event, from FM to, searching by unique identifier.
Now the problem: I need an apple script to change the event’s calendar (Eg. Original calendar: to do > New calendar: done), but surfing in the web I’ve found only scripts to change summary or date and time.
This is the starting script just for locating the event, can someone complete it for me?

“tell application “Calendar”
tell calendar “To do”
show (first event where its description = “BA956D90-339A-4DE5-89B7-2EFFC3F30EC1”)
end tell
end tell”

Just out of curiosity, why do you need to move the event from one calendar to another, as opposed to specifying the correct calendar at the time you make the event?


tell application "Calendar"
    tell calendar "Project Calendar"
        make new event with properties {summary:"Important Meeting!", start date:theStartDate, end date:theEndDate}
    end tell[/AppleScript]

I think Scripting Support for Calendar is pretty broken. I seem to recall comments to that affect previously in this forum. I attempted moving an event between calendars via Applescript, but I just get an error and the event disappears, and then I can't control Calendar via Applescript at all until I restart it.

tell application “Calendar”
set myEvent to event id “1B6D9997-D65F-4141-B908-5D536815F09A” of calendar id “83FD249D-81A8-473D-81A5-0D32E72F5138”
move myEvent to calendar “Family”
end tell[/AppleScript]

I just get the error:

Calendar’s .sdef includes a move command, but it’s in the Standard Suite and it doesn’t appear to have been extended to the app. (Even if it did, I suspect it would only move Calendars, which wouldn’t make a lot of sense.)

In the so-called ‘iCal Suite’, the app is described as responding to various commands (open, create calendar, view calendar etc) but not to move.

The .sdef says that Events are elements of Calendars, not of the application. Which implies that the application itself can’t Move them, because it doesn’t know what they are.

Individual Calendars don’t respond to the Move command. And Events don’t have a Calendar property. So you can’t tell a Calendar to move an Event, or an Event to change its Calendar.

So using AppleScript to ‘move’ an Event from one Calendar to another would appear to be a non-starter.

One way might be to get all the event’s relevant properties, tell another calendar to make a new event with those properties, and then tell the original calendar to delete the original event. Tricky to get right.

(The fact that many of the references in the .sdef are to ‘iCal’ rather than ‘Calendar’ says lots about the level of AppleScript support, but to be fair the app and its elements do respond in precisely the rather limited way described in the .sdef.)

I need to move an event from a calendar to another because I create and manage events in a FileMaker database and I need to send them to just for a more simple overview.
Hubert0’s idea looks pretty but seems very strange that doesn’t support events transition between calendars.
Thanks for Your replies.

Calendar’s scripting is a bit wonky. Sometimes you actually can affect a move on an event, but the item may mysteriously move right back before your eyes, as if it’s correcting an internal error. An approach that might work is creating an intermediate transfer calendar for item duplication and then destroying the original item(s) or calendar, although there is some risk; hopefully, a backup exists for the items slated for destruction, or you test against a smallish and inconsequential data set.

tell application "Calendar"
	make calendar with properties {title:"nonsense"}
	duplicate calendar "home"'s events to calendar "nonsense"
	duplicate calendar "work"'s events to calendar "nonsense"
	delete calendar "home" --watch out
	set calendar "nonsense"'s title to "home"
	calendar "home"'s events's summary -->  merged calendars
end tell

Mmmm, I think this is a risky maneuver due to the high number of events to transfer.
I’m trying hubert0’s suggestion and till now works fine, but I still think that’s impossible that AppleScript cannot move an event to another calendar.