How to Extend Power Manager with Growl

Power Manager supports the open source notification utility, Growl. Growl lets you customise how and when you see notifications from your favourite applications.

Not all applications support Growl. Those that do offer an impressive degree of control over how they can notify you.

Power Manager includes Growl support.

Power Manager comes with Growl support built-in. If you have Growl installed, Power Manager will make use of it. Growl notifications will automatically appear when an event is pending and when an event starts performing.

Let's use Growl to build upon the recipe for displaying a message after a long running task on your Mac.

We want Growl to notify us when an event has finished. These notifications are not built-in to Power Manager, so we need to add them. To do this we are going to use Growl's AppleScript support and Power Manager's ability to run AppleScripts as part of an event.

Growl a Notification Using AppleScript

  1. Launch System Preferences and select Power Manager.
    Open Power Manager.
  2. Open the event to edit in the event editor; hold down the Option and double-click on your event.
    Open the Power Manager event in the event editor.
  3. Add a new action; select Add an action > Run Script > AppleScript.
    Add a new Run Script action to the Power Manager event.
  4. Edit the new action; select the Action's Action cog > Edit.
    Edit the new Power Manager Run Script action.
  5. Copy and paste the following AppleScript into the Script field:
    set myTitle to "Event Finished"
    set myDescription to "The event has finished running."
    tell application "System Events"
        set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
    end tell
    if isRunning then
        tell application id "com.Growl.GrowlHelperApp"
            set the allNotificationsList to {"My Notification"}
            set the enabledNotificationsList to {"My Notification"}
            register as application ¬
                "Growl AppleScript Sample" all notifications allNotificationsList ¬
                default notifications enabledNotificationsList ¬
                icon of application "Script Editor"
            --  Send a Notification...
            notify with name ¬
                "My Notification" title ¬
                myTitle description ¬
                myDescription application name "Growl AppleScript Sample"
        end tell
    end if

    You can customise this AppleScript to change the title (myTitle) and description (myDescription). Both these values can be found near the top of the script.

    Take a look at Growl's AppleScript page for details on further customisations and tweaks.

    Copy and paste in the AppleScript into the Script field.
  6. Click Apply to save the changes to the new action.
  7. Click Save to save the changes to the event.
Apply and Save the changes to the Power Manager event.

Your event is now ready to Growl after the all the actions have finished. Take the time to test your new event. It is important to always test changes as you make them.

This article was posted in , , , and and tagged , , and .

Published by Graham Miln on