applescript错误“;无效的日期和时间日期“;

applescript错误“;无效的日期和时间日期“;,applescript,icalendar,Applescript,Icalendar,伙计们 我是一个苹果书新手。我想在iCal日历中添加许多事件。所有事件都应该是全天事件,因此它们没有开始时间或持续时间。我有一个文本文件中的日期,每行一个。但我只是把它们作为字符串复制到脚本中。这是我的代码(缩短了日期列表): 我从Apple脚本编辑器中得到的错误是 Invalid date and time date (item 1 of every paragraph of 03.01.2015 16.01.2015 30.01.2015 ... 现在,我用英语运行OSX,但我的地区设置为

伙计们

我是一个苹果书新手。我想在iCal日历中添加许多事件。所有事件都应该是全天事件,因此它们没有开始时间或持续时间。我有一个文本文件中的日期,每行一个。但我只是把它们作为字符串复制到脚本中。这是我的代码(缩短了日期列表):

我从Apple脚本编辑器中得到的错误是

Invalid date and time date (item 1 of every paragraph of 03.01.2015
16.01.2015
30.01.2015
...
现在,我用英语运行OSX,但我的地区设置为德国。(本想发布相应首选项屏幕的截图,但在stackoverflow上没有足够的声誉。)

有人能告诉我这里出了什么问题吗? 非常感谢

(这里是在OSX10.10.1上运行的,顺便说一句)

10.8.5

我更改了设置以匹配您所在的地区:

repeat with datum in paragraphs of input
    set datum to date (datum as string)
    tell application "Calendar" to tell calendar "Home"
        make new event at end with properties {summary:"Gargabe", start date:datum, end date:datum, allday event:true}
    end tell
end repeat
(注意,我必须重命名我的日历)
如果我把日期函数放在日历中,告诉它失败了,它之外的工作。。。是否适合您?

根据,Applescript希望看到的日期完全取决于您在Macintosh系统首选项中选择的区域或日期格式。“
16.01.2015
”格式正确吗?是的,系统首选项显示dd.mm.yyyy是它可以理解的正确日期。
repeat with datum in paragraphs of input
    set datum to date (datum as string)
    tell application "Calendar" to tell calendar "Home"
        make new event at end with properties {summary:"Gargabe", start date:datum, end date:datum, allday event:true}
    end tell
end repeat