Secrets of PowerMate 3.0

It’s taken a while, but PowerMate 3.0 was finally released today. I thought I’d take a moment to talk about some of the features that may not be obvious right off the bat.

MENUS

One of the most noticeable new features of PowerMate 3.0 are the fancy radial menus. There are several pre-built menus. They’re pretty self-explanatory, but I’ll go over them real quick here. The Applications Menu is the simplest. It displays all the running apps and lets you quickly switch between them. The Contacts menu shows you all the contact info for the entries in your Address Book and lets you email, chat, or map that contact’s location. The iTunes Menu is the most detailed. It lets you play, pause, jump to the next or previous track, rate the currently playing track, and it displays your music organized by genre, composer, albums, artists, and playlists. You can navigate down through each of these refining what is being viewed as you go. At certain levels, such as a particular artist or genre, you can play all the tracks in the selection, or play the “best of” a particular category. “Best of” includes all those tracks that are rated 4 stars or greater.


Menus in PowerMate 3

The real fun (I think) comes from Custom menus. Custom menus can be added to any trigger and they can contain any number and any kind of PowerMate action. Rather than having a trigger for several different menus and having to remember the modifier keys for each, I’ve got everything in one “mega” menu. And I’ve grouped those actions I think are most important towards the beginning (assuming an oval can be said to have a beginning). Check the video. App launchers towards the beginning, an Applescript to open up the keyboard viewer, the Apps, Contacts, and iTunes aren’t used as often but they’re in there and a submenu with several bookmarks. I’m constantly adding to this menu whenever I find myself thinking “I wish I had a handy way to do X”.

SAVING SETS

One of the things that may not be totally obvious is the ability to save your Sets. This might come in handy for sharing your fancy configurations with friends. And it’s not a bad idea to have a backup in case your settings get hosed somehow. To do this drag a set (or sets) to the Finder. To restore, double click or drag a pmset file into the item list. That’s pretty much it. One thing to keep in mind when saving a set: any external resources such as files, apps, etc., that are referred to in your triggers, aren’t saved with your set. Maybe that’s obvious, but if there is a reference to an app or file that doesn’t exist on the machine where the set is restored, well, it’s not going to launch that app or run that script. For this reason, it’s always better to enter an AppleScript directly into the PowerMate app than referencing an AppleScript file.

LIGHT STATES

While the default light state controls found in a Set are pretty obvious, the Match Light State check box found in the Trigger inspector may not be. What I’ve done is added the ability to control the PowerMate light via AppleScript. It’s not quite as straightforward as just telling the light to blink or pulse however. Instead, you create something called a light state and give it a name. You can find examples in the Extras/Scripts folder on the PowerMate disk image, but in its simplest form creating a light state looks like this:

tell application "PowerMate"
 set aDevice to first device
  tell aDevice
   make light state with properties ¬
    {state type:counter, pulse count:3, pulse length:0.15, name:"Alert x3"}
 end tell
end tell

What this does is create a counter style light state that will pulse 3 times with each pulse lasting 0.15 seconds. It will pause between each set of pulses and repeat the cycle. And the important bit is the name: “Alert x3”. We can now set up a trigger that will only execute if “Alert x3” is the active light state by checking Match Light State and typing Alert x3. (Note: the default light state is called “Default”. You can match against “Default” if you only want to trigger when no custom light state is active.)

If you look in the PowerMate scripting dictionary, you’ll see that it supports four different styles of custom light states: steady, pulse, counter, and yes, morse code. Again there are examples of each in the Extras/Scripts folder on the disk image.

So, great, light states. How would you use these? Well, Apple has support for executing scripts in several apps that might prove handy. The first, and the one that I use the most, is Mail. You can define rules in mail to do a number of things, one of which is to execute an AppleScript. I run a script every time I get a new email that creates a counter style light state called New Mail. I’ve set up a trigger that looks for a state called New Mail and if this it’s active, it switches to Mail and clears the light state back to the default. I also have some scripts in iCal that fire at a certain time of day to remind me it’s lunch time (my PowerMate pulses out “Lunch!” in morse code), and I’ve added a folder action to my shared Dropbox folder so I know when something has been added. iChat is another app that supports scripting on various events and there are plenty of others. I’ll leave it to your imagination how you might use this.

Basically light states not only provide custom notifications, but also allow you to define contextual triggers in PowerMate.

PLUG INS

I hesitate to say that PlugIns are supported in PowerMate because tech support at Griffin will totally not be able to help you with this. However, the application will look for plug ins and load them. PowerMate searches ~/Library/Application Support/PowerMate/PlugIns and loads the bundles it finds there. Classes that conform to the PMActionRep protocol will show up as actions in the Library window. Like I say, this is still half baked at the moment. Hopefully I can put together an example and put it up on github soon. For now, just email me if you want more details.