• 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: Sorting list of calendar events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting list of calendar events


  • Subject: Re: Sorting list of calendar events
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 16 Apr 2015 21:50:25 +1000

On 16 Apr 2015, at 5:48 pm, Jan Erik Moström <email@hidden> wrote:

I use this line to get the events

set theEvents to every event whose ((start date of it) ≥ (todayDate) and (end date of it) ≤ (tomorrowDate))

but how to I do the sorting?

First off, you should be aware that your statement won't return any recurring events that happen to recur in your time range. Second, there's no direct way to sort Calendar events in AppleScript. You probably need to get the start date of the events, plus whatever other properties you want, combine them into lists, and then sort by start date using your favorite AppleScript sorting routine.

The alternative, if you're running Mavericks or Yosemite, is use AppleScriptObjC and script the event store directly. That gets you all the events, and includes a method for sorting them. I posted a basic script for it here a while back, but yell if you're interested and I'll update it to do the sorting. I just need to know what information you want from the events.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

  • Follow-Ups:
    • Re: Sorting list of calendar events
      • From: Shane Stanley <email@hidden>
References: 
 >Sorting list of calendar events (From: Jan Erik Moström <email@hidden>)

  • Prev by Date: Sorting list of calendar events
  • Next by Date: Re: Sorting list of calendar events
  • Previous by thread: Sorting list of calendar events
  • Next by thread: Re: Sorting list of calendar events
  • Index(es):
    • Date
    • Thread