Re: get properties of elements of a Class in Applescript - Related to ical
Re: get properties of elements of a Class in Applescript - Related to ical
- Subject: Re: get properties of elements of a Class in Applescript - Related to ical
- From: Stan Cleveland <email@hidden>
- Date: Thu, 10 May 2007 21:25:48 -0700
- Thread-topic: get properties of elements of a Class in Applescript - Related to ical
Title: Re: get properties of elements of a Class in Applescript - Related to ical
On 5/10/07 12:34 PM, mac script wrote:
> I am trying to get the properties of the element sound alarm of an event in
> iCal using a code similar to:
>
> tell application "iCal"
> set theEvent to event 1 of calendar "Work"
> set theAlarm to sound alarm of theEvent
> set theInterval to trigger interval of theAlarm
> (*Applescript Error
> Can't get trigger interval of {sound alarm 1 of event 1 of calendar 2 of application "iCal"}*)
> end tell
>
> But every time I do this I get an error saying 'Can't get trigger interval of
> {sound alarm 1 of event 1 of calendar 2 of application "iCal"'.
>
> What should I do to get the properties of the elements of iCal in Applescript?
You're inadvertently trying to get the trigger interval of a list, which isn't possible.
(Notice that the reference to sound alarm 1 of event 1 of calendar 2 of application "iCal"
is inside curly brackets.) Why iCal would treat it as a list is anyone's guess, but it does.
What you need to do is extract the reference from the list. Adding "item 1 of" to the line
where the variable theAlarm is defined will do the trick. Like so:
tell application "iCal"
set theEvent to event 1 of calendar "Work"
set theAlarm to item 1 of sound alarm of theEvent
set theInterval to trigger interval of theAlarm
end tell
--> -15
To answer your specific question about properties, again, first get rid of the list:
tell application "iCal"
set theEvent to event 1 of calendar "Work"
set theAlarm to item 1 of sound alarm of theEvent
return properties of theAlarm
end tell
--> {sound file:missing value, sound name:"Basso", trigger interval:-15, ¬
trigger date:missing value, class:sound alarm}
HTH
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden