Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Now that Snow Leopard has arrived, I've stopped using Entourage (woo hoo!) and am now using iCal.

Is there a way to dismiss an iCal alarm (e.g. "meeting at 11:00 am starts in 10 minutes") without using the mouse?

I can't -Tab to the window. If I switch to iCal, the alarm window isn't in focus. I can't -` to that window either.

share|improve this question
    
did you find a solution to that problem? Is there a workaround? –  MostlyHarmless Oct 3 '14 at 17:24
    
Nope, never did. –  Doug Harris Oct 6 '14 at 13:38

5 Answers 5

In AppleScript Editor, create the following script:

tell application "iCal Helper" to quit
delay 2
tell application "iCal Helper" to launch

Using an application like Quicksilver, Butler, FastScripts (lite), Controllermate, etc. create an action/shortcut to launch the script.

The reason I relaunch the application is that we want it open in the background for the next event/message.

share|improve this answer
    
Do I win the answer? –  Kio Dane Jan 5 '10 at 13:16
    
lol @Kio, comment questioning in the wrong place! ;P –  Cawas Apr 1 '11 at 15:06

You can use applescript. This will make the iCal alarm active:

tell application "iCal Helper"
 activate
end tell

You can use something like FastScripts, QuickSilver, LaunchBar, or your keyboard shortcut app of choice to launch the script with a keyboard shortcut of your choosing, and then you can type escape to dismiss it.

I don't think the iCal Helper app is scriptable beyond this as I couldn't get an escape key or a mouse click via mouse coordinates to pass to it. Still, you could give the script a shortcut like Option-Escape, and then follow up with another escape manually to dismiss it.

I couldn't get this to work on 10.5.8, but maybe iCal Helper is more scriptable in 10.6?

tell application "iCal Helper"
 activate
 click at {1062, 300}
end tell

I got the coordinates by typing Command Shift 4 as the screenshot app gives coordinates. The alarms conveniently show up at the same place, but your monitor resolution will cause your coordinates to be different from mine. If anyone is more knowledgeable about AppleScript than me I'm curious why exactly the above "click at" line doesn't work.

share|improve this answer
    
Looks like that script is dependent on a particular screen resolution. Clicking XY coordinates will behave differently for users with 1920*1200 than those with 800*600. Users with multi monitor configs will have even more wild numbers if the secondary display is to the left and/or above the primary (I like that geometry, myself). –  Kio Dane Nov 30 '09 at 18:49
1  
The last paragraph in my answer explained that those are the coordinates for my monitor's resolution and the others will need to figure out their own coordinates. I even explained how to figure it out. –  ridogi Nov 30 '09 at 19:40

Found this

But of course, if you click on the “x” button, Mac OS X actually brings iCal to the foreground, whether you like it or not. In other words, there is no way to dismiss an iCal alarm without switching to iCal. It’s… irritating.

share|improve this answer
1  
That may be another annoyance with how iCal handles windows and alarms, but it has nothing to do with mouse-less dismissal of alarms. –  Doug Harris Sep 23 '09 at 15:16

You can record the action in automator and see if that will work. I think you'll have to "enable access for assistive devices" in the universal accessibility pref pane. I've tried this with a third party app and it worked quite well even though the controls were not named. I would hope apple follows their own guidelines. Once you have the automator script worked out you can launch it via Quicksilver as ridogi mentioned.

share|improve this answer

None of the other answers here worked for me. I'm using the below code (found here) and it works perfectly on OSX Yosemite (10.10.2).

I also tweaked the code a bit to make it work as an Alfred v2 Workflow and posted it on GitHub here.

on run
    closeNotifications()
end run

on closeNotifications()
    try
        -- This function closes all currently displaying notification alerts. It used to also return the titles of each notification, which I have commented out to disable.
        tell application "System Events"
            tell process "Notification Center"
                set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
                --set theseTitles to {}
                repeat with thisWindow in theseWindows
                    try
                        -- Save the title of each alert window:
                        --set thisTitle to the value of static text 1 of scroll area 1 of thisWindow
                        --set the end of theseTitles to thisTitle

                        -- Close each alert:
                        click button "Close" of thisWindow
                    end try
                end repeat --"theseWindows"
                --return theseTitles
            end tell -- "NotCenter"
        end tell -- "SysEvents"

    on error errorMessage number errorNumber
        if errorNumber is errorNumber then
            my addAppletToAccessibilityList()
            error number -128
        end if
    end try
end closeNotifications

on addAppletToAccessibilityList()
    -- This function gets the user to enable Accessibility, for scripting the UI interface (hitting buttons etc.)
    set thisAppletFile to (path to me)
    tell application "Finder" to reveal thisAppletFile
    tell application "System Preferences"
        launch
        activate

        reveal anchor "Privacy_Assistive" of pane id "com.apple.preference.security"

        activate

        display alert ¬
            "Add Applet to Accessibility" message "In order to respond to user clicks on Notification panels and alerts, this applet must be added to the lost of apps approved to use accessibility controls of the OS." & return & return & ¬
            "To add this app:" & return & return & ¬
            "1) Click the lock icon (if it is locked) and enter your password." & return & return & ¬
            "2) If 'SystemUIServer.app' is in the list, check the box next to it's name." & return & return & ¬
            "Otherwise, if the applet's name is in the list, check the box next to it's name. If it's not in the list, drag the applet (currently shown in the Finder) into the list area." & return & return & ¬
            "3) Click the lock to re-lock the preference pane, close System Preferences."
    end tell
end addAppletToAccessibilityList
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.