• 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
Reading Calendar events - need comments/suggestions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading Calendar events - need comments/suggestions


  • Subject: Reading Calendar events - need comments/suggestions
  • From: Jan Erik Moström <email@hidden>
  • Date: Fri, 16 Mar 2018 22:37:19 +0100
  • Authorized-sender: email@hidden

Because of Script Debugger I've started to play with AppleScript again but it seems that I've forgotten most of what I once knew and need some suggestions/comments.

What I want to do is to list the events of a day, the result should be a list like this this:

09:00 - 09:40 Bla bla Bla
10:45 - 12:20 Another bla bla bla
14:30 - 17:10 Yet another bla bla bla

The events are sorted by start time.

My attempt to do this resulted in the script below. However, there are a couple of problems with it:

+ It's slow ... it takes about 20 seconds to execute the script, according to Script Debugger most of the time is spent sending events (if I understand things correctly)

+ The second is the time stamps, is there some way to get "HH:MM" instead of "HH:MM:SS" or do I need to do that formatting myself.

+ What is the best way to get the result sorted?

+ Also, please tell me how this script can be improved.


set theStartDate to current date
set hours of theStartDate to 0
set minutes of theStartDate to 0
set seconds of theStartDate to 0
set theEndDate to theStartDate + (1 * days) - 1
set skipList to {"X", "Y", "Z"}
tell application "Calendar"
        set calList to every calendar
        set eventList to {}
        set listEvents to ""
        repeat with curCalendar in calList
                if (name of curCalendar) is not in skipList then
                        tell curCalendar
set eventList to eventList & (every event where its start date is greater than or equal to theStartDate and end date is less than theEndDate)
                        end tell
                end if
        end repeat
        repeat with curEvent in eventList
                set evStart to the start date of curEvent
                set evEnd to the end date of curEvent
set listEvents to listEvents & (the time string of evStart) & " - " & (the time string of evEnd) & " " & the summary of curEvent & return
        end repeat
end tell
_______________________________________________
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: Reading Calendar events - need comments/suggestions
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: bug in indesign?
  • Next by Date: Re: Reading Calendar events - need comments/suggestions
  • Previous by thread: Re: bug in indesign?
  • Next by thread: Re: Reading Calendar events - need comments/suggestions
  • Index(es):
    • Date
    • Thread