• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iCal: How to retrieve a list of events in chronological order?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: iCal: How to retrieve a list of events in chronological order?
      • From: Paul Berkowitz <email@hidden>
References: 
 >iCal: How to retrieve a list of events in chronological order? (From: "Andy Ihnatko" <email@hidden>)

  • Prev by Date: Re: Itunes - persistent ids not unique (or, managing double integers)
  • Next by Date: Re: iCal: How to retrieve a list of events in chronological order?
  • Previous by thread: Re: iCal: How to retrieve a list of events in chronological order?
  • Next by thread: Re: iCal: How to retrieve a list of events in chronological order?
  • Index(es):
    • Date
    • Thread