我是 AppleScript 的新手,我似乎找不到任何好的资源来帮助我解决我的问题。给定一个包含日期和描述的文件:
September 5, 2013
Event 1.
September 8, 2013
Event 2.
etc.
我想解析日期和事件信息的文件,然后在 Mac 日历应用程序中创建这些天的事件(这些描述和事件标题)。但是,我坚持使用以下代码:
tell application "Finder"
set Names to paragraphs of (read (choose file with prompt "Pick text file containing track names"))
repeat with nextLine in Names
set x to "Thursday, " & nextLine & " 12:00:00 AM"
if nextLine starts with "Sept" then
tell application "Calendar"
tell calendar "My Calendar"
make new event with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:date x, allday event:true}
end tell
end tell
end if
end repeat
end tell
该代码还不起作用,因为它抱怨日期格式不正确,最重要的是,我不知道如何让第二行与日期行一起读取。任何帮助将不胜感激,谢谢。