Date Applescript:剪贴板和日期

Date Applescript:剪贴板和日期,date,applescript,icalendar,Date,Applescript,Icalendar,在applescript中,我可以从数字表中复制日期 当我试图在iCal活动中将其作为“开始日期”时,它不起作用 以下是工作原理: set start_date to date ("2 juin 2014") set end_date to date ("3 juin 2014") tell calendar "Cal" make new event at end with properties {summary:"Chris", start date:start_date, end

在applescript中,我可以从数字表中复制日期

当我试图在iCal活动中将其作为“开始日期”时,它不起作用

以下是工作原理:

set start_date to date ("2 juin 2014")
set end_date to date ("3 juin 2014")

tell calendar "Cal"
    make new event at end with properties {summary:"Chris", start date:start_date, end date:end_date}
end tell
以下是不起作用的内容(假设剪贴板是“2014年2月”)

谢谢你的回答


Dam

将日期创建移到应用程序通知块之外。您没有显示

tell app "Calendar"
部分代码(请在将来这样做)来说明问题,但这似乎是您的冲突。工作代码如下所示:

set dateString to the clipboard as Unicode text  -- "22 Juin 2014"
set start_date to date (dateString)
set end_date to date ("23 Juin 2014")

tell application "Calendar"
    tell calendar "Cal"
        make new event at end with properties {summary:"Chris", start date:start_date, end date:end_date}
    end tell
end tell 
最好不要将不需要的东西放在应用程序的告诉块中

set dateString to the clipboard as Unicode text  -- "22 Juin 2014"
set start_date to date (dateString)
set end_date to date ("23 Juin 2014")

tell application "Calendar"
    tell calendar "Cal"
        make new event at end with properties {summary:"Chris", start date:start_date, end date:end_date}
    end tell
end tell