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.
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 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
Launch System Preferences and select Power Manager.
Open the event to edit in the event editor; hold down the **Option **and double-click on your event.
Add a new action; select Add an action > Run Script > AppleScript.
Edit the new action; select the Action’s Action cog > Edit.
Copy and paste the following AppleScript into the **Script **field:
#!/usr/bin/osascript 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.
Click Apply to save the changes to the new action.
Click Save to save the changes to the 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.