Re: iCal alarm scripts
Re: iCal alarm scripts
- Subject: Re: iCal alarm scripts
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 10 Jan 2010 21:33:49 -0800
- Thread-topic: iCal alarm scripts
On 1/10/10 8:11 PM, "Josh Tishhouse" <email@hidden> wrote:
> So, there's no real way to "Automagically" get the data from the iCal event
> that launched your script, but here's how I do it:
>
> set myCalendar to "calendar name"
> tell application "iCal"
> activate
No need to activate. It can go on in the background if you prefer.
> set theEvent to the last event of calendar myCalendar
The last event will be the last one *created* in that calendar, which is
very much *not* necessarily the one that just sent the alarm. I don't think
this will help at all. Not to mention - how do you even know which is the
right calendar? You'd need to check all of them.
The only way to get a rough-and-ready hope of a solution here would be to
get (current date), set a variable (say theTime) to it, then set the seconds
of theTime to 0. (It's probably been a few seconds since the alarm was
called, and in any case, the alarm would set to the minute, not second.)
Then go through every calendar, checking for 'every event whose start time
theTime' (which could be a LOT of events). Then go through every such event,
getting 'every display alarm of it whose trigger date = theTime', same for
every sound alarm, etc, and every type of alarm which you expect or use.
Hopefully, there's only one alarm that went off at exactly that time, so you
can probably quite the two repeat loops (events and calendars) when you find
one. Then get the summary of the event in question and that's your answer.
It could give you the wrong answer if there's more than one alarm that went
off at the same time (or else, don't quit the repeat loop but get all of
them), and it could take a very long time.
Frankly, I don't think it's worth it.
> set theDescription to description of theEvent
> set theDuration to (end date of theEvent) - (start date of theEvent)
> set theTitle to name of theEvent
> set theAttendee to display name of (first attendee of theEvent)
>
> And so on.
>
> Hope this helps,
>
> -Josh
>
> Joshua Tishhouse: Systems Administrator at The University of Michigan LSA ISS
> contact | email@hidden - 734-945-6141 | iChat/AIM - email@hidden
>
>
> On Jan 10, 2010, at 5:20 PM, Bruce Horrocks wrote:
>
>> I'm really struggling trying to find any documentation re what a script can
>> expect when called as a result of an alarm event by iCal.
>>
>> So far, all I've managed to discover is that, according to 'name of (current
>> application)', my test script is being called by 'iCal Helper' (IH).
>> Unfortunately IH does not appear to have a dictionary.
>>
>> Is it possible for an invoked script to find out the name of the calendar
>> entry that triggered it? I'd like to get hold of the title if at all
>> possible.
>>
>> Thanks in advance.
>> --
>> Bruce Horrocks
>> Surrey
>> England
>> (bruce at scorecrow dot com)
>> __
>
> _______________________________________________
> 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
--
Paul Berkowitz
_______________________________________________
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