有没有办法在数字上统计一天中的日历事件的数量?

时间:2016-05-27 15:24:51

标签: calendar applescript

set every_Calendar to every calendar

        --set calendarToday_Events to every event whose start date is greater than or equal to time_Today and start date is less than or equal to time_Tomorrow
        set calendarToday_Events to (count (events of every_Calendar whose start date is greater than or equal to time_Today and start date is less than or equal to time_Tomorrow))
        ----------------------------------

say "There are " & calendarToday_Events & " on current date"

我正在尝试创建一个脚本,说明一天中有多少事件。

1 个答案:

答案 0 :(得分:0)

您必须使用小时分秒和日期来定义开始日期和结束日期,然后下面的脚本会为您提供事件数量:

tell application "Calendar"
set my_Calendars to every calendar
set Total_Events to 0
repeat with a_calendar in my_Calendars
    tell a_calendar to set my_Events to (every event whose (start date is greater than or equal to Debut) and (start date is less than or equal to Fin))
    set Total_Events to Total_Events + (count of my_Events)
end repeat
display dialog (Total_Events)
end tell

如果您直接询问每个日历的每个事件,您将获得一个列表清单。