Re: iCal: How to retrieve a list of events in chronological order?
Re: iCal: How to retrieve a list of events in chronological order?
- Subject: Re: iCal: How to retrieve a list of events in chronological order?
- From: kai <email@hidden>
- Date: Sun, 12 Mar 2006 15:32:10 +0000
On 12 Mar 2006, at 11:03, Andy Ihnatko wrote:
Okay, I give up. How do I ask iCal "Give me the next three events from
this calendar"?
Seems a little curious that iCal doesn't seem able to dispense events
chronologically, Andy - but I'd be inclined to go with something
along the lines of Jakob's suggestion. If it helps, this works here:
-------------
to sort_items from i
script o
property l : i
end script
repeat with i from 2 to count o's l
set v to o's l's item i
repeat with i from (i - 1) to 1 by -1
tell o's l's item i to if v < it then
set o's l's item (i + 1) to it
else
set o's l's item (i + 1) to v
exit repeat
end if
end repeat
if i is 1 and v < o's l's beginning then set o's l's item 1 to v
end repeat
end sort_items
on next_events from c for n
tell application "iCal" to tell calendar c
set l to start date of events whose start date > (current date)
tell (count l) to if it < n then set n to it
if n is 0 then return {}
my (sort_items from l)
set l to l's items 1 thru n
repeat with i in l
set i's contents to (i's month as Unicode text) & ¬
space & i's day & " - " & summary of ¬
(first event whose start date is i)
end repeat
end tell
l
end next_events
next_events from "Home" for 3
-------------
--> {"March 15 - Anti-Velcro protest rally", "March 17 - Society for
Mundane Anachronism meeting", "March 22 - Foreclose on orphanage"}
---
kai
- who fervently hopes you reconsider the orphanage thing. ;-)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden