Interaction with Applescript and iCal

I am trying to write AppleScript for an iCal request and find all the events that I have for a given date in any calendar.

I started writing a simple script that does something simple with every event on this calendar:

tell application "iCal"
  tell calendar "Reuniones"
    set the_events to every event
    repeat with an_event in the_events
        -- do something with every event
        set value to summary of an_event
    end repeat
   end tell
end tell

However, this simple script takes a lot of time to execute (a few seconds), even if I am not doing anything complicated inside the loop. I am afraid that a real script will really take a long time to execute.

I am not very familiar with Applescript, and I believe I am doing something stupid that has serious performance implications.

- , ? - - ? . , (, Automator), "" .

EDIT: Mac OS X Tiger (10.4). , iCal .

+3
3

, ( , Snow Leopard). ,

tell application "iCal"
    set out to ""
    set todaysDate to current date
    set time of todaysDate to 0
    repeat with c in (every calendar)
        set theEvents to (every event of c whose start date β‰₯ todaysDate)
        repeat with current_event in theEvents
            set out to out & summary of current_event & "\n"
        end repeat
    end repeat
    return out
end tell

, .

+5

AppleScript, iCalBuddy, API Cocoa , .

icalBuddy -nc -eed -iep title,datetime eventsToday+1

+3

, , , , iCal .

, , . , , " ", .

, , Apple Script, "ics", .

For reference, these files are located in '~ / Library / ApplicationSupport / iCal'.

0
source

Source: https://habr.com/ru/post/1709415/


All Articles