You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用AppleScript获取带UID的Mac日历应用列表?

解决MacOS日历AppleScript获取唯一标识符报错问题

你遇到的问题是因为Calendar的AppleScript接口里,日历的唯一标识符属性名为id,而非你代码里写的uid——访问不存在的属性自然会触发错误。

修正后的代码如下:

tell application "Calendar"
    set calendarList to {}
    repeat with aCalendar in calendars
        set end of calendarList to {id of aCalendar, name of aCalendar}
    end repeat
    return calendarList
end tell

运行这段代码就能正常获取每个日历的唯一ID和名称,后续你可以用这个ID指定目标日历推送事件。

内容的提问来源于stack exchange,提问作者jeznag

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 06:30:02