程序化导入ICS文件到日历

1 投票
2 回答
1139 浏览
提问于 2025-04-17 08:19

我用Python和iCalendar模块写了一个ICS文件。

我遇到的问题是,怎么让iCalendar去读取这个ICS文件?我原以为可以把它放在 ~/Library/iCalendar/<--->/Events 这个地方,但看起来那里只是存放已经导入的ICS文件。

有没有人知道我该怎么做?

谢谢!

2 个回答

0

你可以让iCal打开这个ics文件。

1

你可以使用AppleScript或者Python的脚本桥接框架。无论哪种方式,都是让iCal添加事件。

这里有一个AppleScript的例子:

tell application "iCal"
   tell calendar "Work"
      set theDate to current date
      make new event at end with properties {description:"The Event Description", 
         summary:"Event Name", location:"Main Street", start date:theDate, 
         allday event:true}
   end tell
end tell

或者你也可以用同样的方法告诉iCal打开并导入那个文件。

撰写回答