gpt4 book ai didi

applescript - 使用 Applescript 从 iCal 获取今天的事件

转载 作者:行者123 更新时间:2023-12-05 00:04:12 25 4
gpt4 key购买 nike

我遍历 iCal 中的所有事件以仅获取今天的事件,但我认为这效率不高。是否有仅获取今天事件的功能/方法?

tell application "iCal"
tell calendar "Lotus Notes"
set today to (current date)
set this_year to year of today
set this_month to month of today
set this_day to day of today

repeat with c in every event
set d to start date of c
set the_year to year of d
set the_month to month of d
set the_day to day of d
if (the_year = this_year) and (the_month = this_month) and (the_day = this_day) then
show c
end if
end repeat
end tell
end tell

最佳答案

尝试这个:

set {year:y, month:m, day:d} to current date
set str to (m as string) & " " & (d as string) & " " & (y as string)
set today to date str
set tomorrow to today + 60 * 60 * 24

tell application "iCal"
tell calendar "Lotus Notes"
set curr to every event whose start date is greater than or equal to today ¬
and start date is less than or equal to tomorrow
end tell
end tell

关于applescript - 使用 Applescript 从 iCal 获取今天的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5907368/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com