基本上我的目标是能够在这个 AppleScript 中使用 Python 的开始和结束日期作为参数。
import commands
cmd = """osascript -e 'tell application "Calendar"
set all_calendars to title of every calendar
if "SimpleCal" is in all_calendars then
set primary_calendar to "SimpleCal"
else
create calendar with name "SimpleCal"
set primary_calendar to "SimpleCal"
end if
set start_date_mod to date %s
set end_date_mod to date "Wednesday, August 14, 2013 at 8:10:00 PM"
tell calendar primary_calendar
set new_event to make new event at end with properties {description:"Imported with App", summary:"event_type", location:"", start date: start_date_mod, end date:end_date_mod}
tell new_event
make new display alarm at end with properties {trigger interval:-5}
end tell
end tell
end tell
'""" % ("Wednesday, August 14, 2013 at 8:00:00 PM")
status = commands.getoutput(cmd)
print status