Ical event properties

Can anyone tell me how to get the event properties of a selected iCal event. I know that iCal does not have a selection property but I want to read the properties of a particular event and I am getting nowhere

http://macscripter.net/viewtopic.php?id=16882

In Snow Leopard you get more than just the summary.

Hi

No good thanks. Already been there. I need to access the unique event uid embed in the event. ie its properties.
This is a tricky one but thanks for your input

This is a work-around but it seems to work OK. Maybe it will be good enough for your purposes. It uses the fact that you can select an event in iCal and press command-c to copy some of the event details to the clipboard. So we can use that to find the selected event. Note: you can get more detailed than I have in this script and I mention one way in the script comments.

To use this, select an event in iCal and then run this script…

tell application "iCal" to activate
delay 0.2

-- put the selected event onto the clipboard
-- note: on recurring events a dialog window pops up that you have to dismiss, thus the a/b/keystroke return code
tell application "System Events"
	tell process "iCal"
		set a to count of windows
		keystroke "c" using command down
		set b to count of windows
		if b > a then keystroke return
		delay 0.5
	end tell
end tell

-- get the clipboard contents
set {eventTitle, eventDate} to paragraphs of (get the clipboard)

-- find the event with the eventTile
-- note: you can get more detailed if you want by also using the eventDate, which isn't done in this script
tell application "iCal"
	set allCalendars to calendars
	repeat with aCal in allCalendars
		try
			set theEvent to (first event of aCal whose summary is eventTitle)
			return properties of theEvent
		end try
	end repeat
end tell

Here’s another effort, which works with non-recurring events in iCal 4.0.3 as set up on my Snow Leopard system. I haven’t been able to do anything similar with iCal 2.0.5 in Tiger. As with all GUI Scripting, it may not work on other people’s machines.

tell application "System Events"
	tell application process "iCal"
		set UIName to name of (first static text of UI element 4 of front window where it is selected)
	end tell
end tell

set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to " - "
set eventSummary to text 1 thru text item -2 of UIName
set eventDate to text item -1 of UIName
set AppleScript's text item delimiters to astid
set eventDate to date eventDate

tell application "iCal"
	get first event of calendars whose summary is eventSummary and start date is eventDate
	repeat with thisItem in result
		if (thisItem's class is event) then
			set theEvent to thisItem's contents
			exit repeat
		end if
	end repeat
	theEvent's properties
end tell

Nigel and Regulus THANK YOU

Got the info i need

I am working on a script that will action .ics files to ical. Sounds easy but so many bugs in iCal with the deleting of events with another .ics file. I now know that the .ics file defines the id for the event in iCal (Thanks all). So its now easy to identify the event to delete from an imported .ics file.
will post a script when finished. Should be useful for anyone trying to import ics files to iCal