Moving events between iCal calendars based on keywords

Hi everyone,

I’m trying to find an AppleScript solution to an iCal problem.

We have a couple of different calendars for ‘Unconfirmed’ and ‘Confirmed’ events. When we first put an event in it goes in the unconfirmed calendar. When the event is confirmed we move it to the confirmed calendar. I’d love to be able to automate this as often there are a lot of iCal entries for a given event. I was hoping to do this using a keyword search. I’ve done a fair amount of googling and have ended up with this (courtesy of someone else with a similar idea):

tell application "Calendar"
	repeat while (count of ((events of calendar "Unconfirmed") whose summary contains "Test")) is greater than 0
		move ((events of calendar "Unconfirmed") whose summary contains "Test") to calendar "Confirmed"
	end repeat
end tell

When I try this though I’m getting an error from iCal, “There was an error saving calendar data.”

Am I making a basic error somewhere? Thanks for your help in advance.

Pd

Hi. If it worked properly, your repeat loop would be unnecessary, as move would affect all items at once. I messed around with it, and I’m leaning towards it not working related to there being a bug. I see Calendar move the events, but they come right back, along with a database error. A workaround could be:

tell application "Calendar"
	duplicate (calendar "Unconfirmed"'s events whose summary contains "Test") to calendar "confirmed"
	delete (calendar "Unconfirmed"'s events whose summary contains "Test")
end tell

It’s 2018 and this bug hasn’t been fixed yet.
Beside duplicating the event, anyone came up with a solution?