Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Running 10.8 Mountain Lion, I'm trying to create a new event with Applescript like this:

set theDate to (current date)
tell application "Calendar"
tell calendar "Calendar"        
    set timeString to time string of theDate
    set newEvent to make new event at end with properties {description:"Last Backup", summary:"Last Backup " & timeString, location:"To a local unix system", start date:theDate, end date:theDate + 15 * minutes, allday event:false, status:confirmed}
    tell newEvent
        delete every display alarm
        delete every sound alarm
        delete every mail alarm
        delete every open file alarm
    end tell        
end tell
end tell

However, this does not remove the default Calendar alert which one can set through Calendar preferences (30 minutes prior in my case).

How do I create an event with no alarms at all through Applescript?

share|improve this question

It looks like another case of AppleScript getting the unwanted-stepchild treatment. I suggest filing a bug with Apple.

Specifically, the buggy behavior is as follows, as of OS X 10.8.2:

-- Trying to set ANY properties on the *default* sound alarm fails silently.
-- Programmatically added alarms: only the trigger interval or date can be set.
repeat with al in every sound alarm of newEvent
    tell al
        -- Works only on *programmatically added* sound alarms:
        set trigger interval to -770 # The alternative option, `set trigger date to ...`, works as well.
        -- Fails silently on *all* sound alarms, whether it is the default one or a programmatically created one.
        set sound name to "Pop" # `set sound file to ...` fails equally.
    end tell
end repeat

-- This only deletes the programmatically added alarms, but never the default one.
delete sound alarms of newEvent

Thus, sadly, silencing the default alarm by manipulating its properties is not an option.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .