Getting the Event Unique ID of a newly created iCal event

Hi everyone,

I am trying to get the new event id of this iCal event that I have created. I have tried many things - managed to get the calendar id on some of my tries, but not the event id!!! It is driving me ever so slightly crazy!!

The script is as follows. The “set eventID1…” section comes up with the Calendar ID in this state instead of the Event ID, but it will give an idea of what I am trying to do.


tell application "iCal"
tell calendar "Work"
			make new event at end with properties {description:"", summary:theNickname, start date:myDate, end date:myDate + 45 * minutes}
set eventID1 to uid
		end tell
		end tell

Please help…

Hi,

the uid line is within the calendar tell block, therefore you get the UID of the calendar.
You need a reference to the new created event


tell application "iCal"
	tell calendar "Work"
		set newEvent to make new event at end with properties {description:"", summary:theNickname, start date:myDate, end date:myDate + 45 * minutes}
		set eventID1 to uid of newEvent
	end tell
end tell

or, using your syntax


tell application "iCal"
	tell calendar "Work"
		tell (make new event at end with properties {description:"", summary:theNickname, start date:myDate, end date:myDate + 45 * minutes})
			set eventID1 to uid
		end tell
	end tell
end tell

Dear Stefan,

Thank you!! Rookie mistake!! I can’t believe that I missed that possibility.

All the best…