How to Growl trigger an shell script or AppleScript (NOT vice versa!)

applescriptcustomizationgrowlscript

When a Growl notification gets issued I want to trigger an AppleScript. I had a look at the "Actions" in the Growl preferences, and you can trigger things like an email or a text-to-speech call, but not an arbitrate shell script or AppleScript.

Any idea how to do this? Does a Growl plugin for this exists? I searched the net for it, but could only find solutions for the other way around (i.e. issuing a notification from a script).

Many thanks in advance!

Best Answer

Growl 2.1 does support ScriptActions, but it doesn't seem to be documented anywhere but a google group thread. Below is a simple example from the thread. You create a script file with the content, place it in ~/Library/Application Scripts/com.Growl.GrowlHelperApp, and then set it up inside Growl as described in the same thread.

using terms from application "Growl"
    on perform action with notification
        ignoring case
            if notification's app name is "test growl" then
                activate me
                display dialog "goodbye" with icon 1
            end if
        end ignoring
    end perform action
end using terms from