【问题标题】:Adding and removing data to/from iCal在 iCal 中添加和删除数据
【发布时间】:2014-09-08 09:22:49
【问题描述】:

我需要在 iCal 中添加/删除日历数据。

我 google 发现我可以使用python library 来创建 ics 文件。有了这个,我可以想出applescript来运行iCal来导入生成的ics文件来给iCal添加日历信息,但是对于删除日历信息,我不知道具体该怎么做。

  • Q1:如何用applescript或python删除iCal中的日历数据?
  • Q2:在 iCal 中添加日历数据的其他方法是什么?

【问题讨论】:

    标签: python applescript icalendar


    【解决方案1】:

    要删除 iCal 中的事件,您需要能够识别它。这可以通过事件的 uid 属性或其他一些识别信息来完成。这是一个简单的例子:

    tell application "iCal"
        tell calendar "Chuck"
            set evt to make new event at end with properties ¬
                {description:"description", summary:"Summary", start date:get current date}
            set evtID to uid of evt
            set delEvt to every event whose summary is "Summary"
            delete delEvt
        end tell
    end tell
    

    您可以通过查看 iCal 的字典(文件>在脚本编辑器中打开字典)找到可用于事件的属性列表。

    【讨论】:

      猜你喜欢
      • 2019-01-25
      • 2023-03-17
      • 1970-01-01
      • 2020-08-08
      • 1970-01-01
      • 2016-02-07
      • 1970-01-01
      • 2019-04-09
      • 1970-01-01
      相关资源
      最近更新 更多