在applescript中为日历事件创建“打开文件警报”

时间:2018-04-20 17:20:47

标签: applescript icalendar

我在使用AppleScript的“打开文件”警报创建日历约会时遇到了一些麻烦。创建事件不是问题,但是,我无法使打开文件警报位工作。我确定我错过了一些愚蠢的东西,但任何帮助都会受到赞赏......

set resultTime to time string of date ("09:45" as string)

set startTime to (date (resultTime)) + (1 * days)
set endTime to startTime

set alertPath to (POSIX path of (path to home folder as string)) & "Documents/TestScript.app"

tell application "Calendar"
    tell calendar "Test Calendar"
        make new event with properties {summary:"Start Script", start date:startTime, end date:endTime}
        set calEvent to the result
        tell calEvent
            make new display alarm at end with properties {trigger interval:0}
            make new display alarm at end with properties {trigger interval:-15}

            make new open file alarm at end with properties {trigger interval:-15, filepath:alertPath}
        end tell
    end tell
end tell

我暂时放入一些显示警报来检查我是否可以创建它们,这样可以只有'make new open file alarm ...'行。变量resultTime来自最终脚本的早期版本,但是,我在测试时已将其全部删除。

感谢您的帮助!

0 个答案:

没有答案