Passing iCal description to variable in Applescript

Goal: To pass the description of an event from iCal to Applescript.
Reason: I would like to write the description of the iCal event to a text file.

So basically what I need is the function / scriplet to pull the description and assign to a variable. Any help is appreciated. Thanks !


-- Script magic to get iCal description out of iCal
-- set myDesc to iCal description
set myDescFile to alias "Macintosh HD:Users:xxxxx:Desktop:desc.txt"
set eof of myDescFile to 0
open for access myDescFile with write permission
write myDesc to myDescFile
close access myDescFile

Hi,

you can retrieve the information by specifying the event


tell application "iCal" to set myDesc to description of event 1 of calendar 1

Stefan,
Thanks for your response but I am apparently still missing something basic.

-- Script magic to get iCal description out of iCal
tell application "iCal" to set myDesc to description of event 1 of calendar 1
-- set myDesc to iCal description
set myDescFile to alias "Macintosh HD:Users:xxxx:Desktop:desc.txt"
set eof of myDescFile to 0
close access myDescFile
open for access myDescFile with write permission
write myDesc to myDescFile
close access myDescFile

When this script is called due to an alarm, I get “Applescript event alarm did not execute properly … did not open or did not finish running”.
If I run it from script editor I get “I get variable not defined” which I expected.

I am sure it is something simple but simple things always defeat me. Thanks in advance.