0

基本的に私の目標は、この 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
4

1 に答える 1