More ical stuff

Hi

Like Woodenbrain I am also having a lot of difficulty with scripting ical. I am now trying to create an appointments diary with filemaker and ical. When I have finished I will post the scripts but I need some help here. Is there anyway I can coerce this into a string to save to a field in FM?

tell application “iCal”
set theevent to event id “9C1003B9-7479-4191-BFC4-4777DAA7D085” of calendar id “B74E3053-852B-49A5-9945-5C5DBAF58EDE” of application “iCal”

end tell
theevent as string

This will produce an error —Can’t make «class wrev» id “9C1003B9-7479-4191-BFC4-4777DAA7D085” of «class wres» id “B74E3053-852B-49A5-9945-5C5DBAF58EDE” of application “iCal” into type string.

Thanks

Model: 11 macs, all my babies
AppleScript: 2.1.1
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)

Hi,

first, you can’t coerce an event to a string
second, the syntax must be

tell application "iCal"
    set theevent to event id "9C1003B9-7479-4191-BFC4-4777DAA7D085" of calendar id "B74E3053-852B-49A5-9945-5C5DBAF58EDE"
end tell
tell application "whatever" to get something of application "whatever"

doesn’t work

Hi Stefan

It does coerce to a record


tell application "iCal"
	set theevent to event id "9C1003B9-7479-4191-BFC4-4777DAA7D085" of calendar id "B74E3053-852B-49A5-9945-5C5DBAF58EDE" of application "iCal"
	
end tell
theevent as record

Perhaps I am really barking up the wrong tree here but I want to be able to save a reference to this event in Filemaker somehow and if anyone can do it its you boys out there. If not then I will have to think of other ways

isn’t it sufficient to store the unique id of the event?

tell application "iCal"
	get uid of event 1 of calendar 1
end tell

Thanks Stefan

Your post changed my thinking. iCal still needs the calendar id to find the event to delete. So when I create the event in filemaker (which inturn inserts it into iCal) I get the script to copy back to FM the uid and the calendar id. SHould I want to delete the event I can call on that info


tell application "FileMaker Pro Advanced"
	set eventuid to cell "event uid" of current record
	set calendarid to cell "calendar id" of current record

end tell
tell application "iCal"
	
	delete event id eventuid of calendar id calendarid
	
end tell

You don’t need uid and calendar id, the unique uid is sufficient


tell application "FileMaker Pro Advanced"
	set eventuid to cell "event uid" of current record
end tell

tell application "iCal"
	repeat with i in calendars
		if eventuid is in (get uid of events of i) then exit repeat
	end repeat
	try
		delete event id eventuid of i
	end try
end tell

You might want to review this thread too about the aftereffects of deletions

If you delete single events by uid, not by references in a list, there’s no problem.

And consider the significant difference between

repeat with i in list

and

repeat with i in (get list)

:wink: