Add Attendee to iCal Event

Ok, I’ve tried everything that I can think of and I cannot script the addition of an attendee to an event in iCal [version 1.5.1 on OS X 10.2.8]. As far as I can determine, this should work but it doesn’t. I’m approaching script rage! :wink:

set date_string to "11/7/03"
set due_date to date date_string

tell application "iCal"
	
	set cal_ to first calendar whose title is "Home"
	
	set new_event to make event at end of events of cal_ with properties ¬
		{due date:due_date, summary:"Release secret application"}
	
	tell new_event
		make display alarm at end of display alarms with properties ¬
			{trigger interval:-60}
		
		make attendee at end of attendees with properties ¬
			{display name:"Rob J.", email:"robj@woh.rr.com"}
	end tell
end tell

It works right up to the ‘make attendee’ part. Any ideas or working code? All suggestions will be welcome and appreciated.

– Rob

I haven’t tried this but maybe this will work

make attendee at end of attendees of new_event with properties ¬ 

Thanks for trying but it fails. :confused:

– Rob

Looks like a bug. If you manually add an event and then an attendee and then run this code based on your code, it works:

If the attendees hasn’t been initialized it fails.

Jon

[This script was automatically tagged for color coded syntax by Script to Markup Code]

Thanks for confirming my suspicions, Jon. I hadn’t considered trying it that way. I wonder if Jaguar users will still be able to obtain updated versions of iCal. Oh well, I reckon I should file a bug report anyway. :wink:

– Rob

Rob, does this work?

http://scriptbuilders.net


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Hey, way to go Greg! Putting it all together:

This works on my machine: 10.3/iCal 1.5.1 (v616)

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

You all did all of the work, I just noticed Jon’s comment “If the attendees hasn’t been initialized it fails.” and thought I’d try using “at beginning” instead of “at end” & voila!

It works for me! I’m almost certain that I tried it before but I guess not. Thanks men! :slight_smile: