Growl Notifications for iCal (How-To)

by Thomas Aylott Fri, 21 Jul 2006 17:10:00 GMT

I love iCal, but I really hate the giant reminder panel stealing focus and getting in the way. Ewww.

I love Growl. There was an obvious need for a way to do iCal Growl notifications.

iCal has a nice feature where you can run an applescript using the Open File… feature in the alarm thing. The problem with this is that it doesn’t send any applescript variables to the script. So you would have to either do a generic alert for every reminder or have a separate script for each reminder. This is not hip, nor DRY.

I went searching for a solution to this and came across the article iCal and Growl @ Origa.me.uk where he shows you how to hack the internal applescript file that handles sending an Email on an alarm. This is totally awesome! You get access to all of the variables and can do the Growl. The only problem with his method is that it removes your ability to ever send another Email Alarm again.

I took his idea and added a simple if filter to the applescript. It works by checking for the email address “Growl”. If it sees that address then it does a Growl thinggy, otherwise it does the email like normal.

Download the Scripts

iCal Mail Script (with Growl Support)

How to Install & Use

  1. Add the email address ”Growl”
    to your personal Address Book entry.
    • (Mark it as secret if you have that feature enabled.)
  2. Copy Mail.scpt into the iCal resources.
    • /Applications/iCal.app/Contents/Resources/
  3. Copy Mail.scpt into the iCalHelper resources.
    • /Applications/iCal.app/Contents/Resources/iCal Helper.app/Contents/Resources/
  4. Quit iCal
    • You should Quit iCalAlarmScheduler too,
    • or you can log out and back in.
  5. Make a new iCal Event
  6. Make a new Email Alarm on that event
    1. Set the email address to “Growl”
  • Bask in the awesome iCal Growl Alarm goodness!

Here is the actual code:


on send_mail_sbr(subjectLine, messageText, myrecipient)
    if myrecipient = "Growl" then
        send_mail_sbr_GROWL(subjectLine, messageText, myrecipient)
    else
        send_mail_sbr_EMAIL(subjectLine, messageText, myrecipient)
    end if
end send_mail_sbr

on send_mail_sbr_EMAIL(subjectLine, messageText, myrecipient)
    tell application "Mail" 
        set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
        tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
        send mymail
    end tell
end send_mail_sbr_EMAIL

on send_mail_sbr_GROWL(subjectLine, messageText, myrecipient)
    tell application "GrowlHelperApp" 
        set theName to "New Event" 
        set theAppName to "Custom iCal Notifications" 
        set the allNotificationsList to {theName}
        set the enabledNotificationsList to {theName}

        register as application theAppName ¬
            all notifications allNotificationsList ¬
            default notifications enabledNotificationsList ¬
            icon of application "iCal" 
        notify with name theName ¬
            title subjectLine ¬
            description messageText ¬
            application name theAppName ¬
            with sticky
    end tell
end send_mail_sbr_GROWL

Posted in Growl, AppleScript, Mac OS X, Tip

My TextMate Bundles, Commands, Macros, etc...

by Thomas Aylott Sun, 05 Feb 2006 15:41:00 GMT

Ahhh TextMate, how I love thee.

This is just a quick post to share a couple of handy TextMate commands.

Balance Jr textmate thinggy

Balance Jr Textmate Macro

(?<=(<%@\s|<%#\s|<%=\s))[^%]*(?=\s%>)|(?<=<%\s)[^%]*(?=\s%>)|(?<=</)[^/>]*(?=>)|(?<=<)[^/>]*(?=/>)|(?<=<!--\s)[^->]*(?=\s-->)|\b\w+\b(?=\s*=)|\s\b\w+\b=\"[^\"]*\"|(?<=\\")[^\\"\n]*(?=\\")|(?<=')[^'\n]*(?=')|(?<=\[)[^\[\]]*(?=\])|(?<={)[^{}]*(?=})|(?<=<)[^<>\n]*(?=>)|(?<=[^/]>)[^><]*(?=</)|(?<!\d)\d+(?!=\d)|[@$!]\w+\b|(?<=/\*).*(?=\*/)|(?<=[\(,])[^\(\),]*(?=[\),])

You place your caret inside something and the macro will select everything in between enclosing characters. It’s kinda like the balance command, except it grabs everything INSIDE the characters, but not the characters themselves.

It works with:

[], {}, (), '', "", word="", <>, ><, $word, @word, /* word */, <% word %>, <%= word %>, <%# word %>, <%@ word %>, integers, comma separated values, and probably more, but I forget now.

If you want to select the paragraph text section of the following HTML, place your caret somewhere in the text and hit the macro. It’ll select everything between the > & < characters.


<p class="blah">
     paragraph text 
</p>

Here’s all the crazy stuff!

All these files are .tmbundle packages. I have them in my personal TextMate folder ~/Library/Application Support/TextMate/Bundles/. All my TextMate stuff is now being hosted in SVN at http://textmate.svn.subtlegradient.com/. Enjoy!

Back to a regular folder. Blaaarrgghhh!

These linked files are now ZIPs, yet again. But Safari will auto un-zip them for you to just double click on in your downloads panel.

That’s all. It’s been a pleasure, as always!

Posted in Screencast, Tip, Code, TextMate | 16 comments | no trackbacks

Gus Mueller FlyOpts InputManager

by Thomas Aylott Tue, 27 Dec 2005 08:00:00 GMT

I just came across a truly amazingly sweet little thing.

How I found it

  1. Of grasshoppers and O_S
  2. Menu Accelerator
  3. FlyOpts InputManager

What is it?

To quote the author:

A warning: input managers are bad… This bit of code [is] probably only useful to developers … it’s not like a product or anything. Think of it as sample code.

  • Edit in BBEdit from any NSTextView
  • Menu Accelerator- Marrying Search Kit and NSMenuItem in some sort of unholy union
  • Execute as Lua in any NSTextView

He’s got a slick video of the Menu Accelerator and another one activating a shell script

To get it to work with TextMate ...

Read more…

Posted in TextMate, Tip, Mac OS X | no comments | no trackbacks

Older posts: 1 2 3