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.
Thanks so much for your PowerMate info. I can’t get my light state to work. I read your article completely. I just want the light to toggle on and off every time I press the button. I already have a Skype script that toggle mutes the microphone on skype. I want the light to match.
Thanks
Gordon
You could use a script like this (just remember to set the default light settings to Off):
tell application “PowerMate”
set aDevice to device named “PowerMate”
tell aDevice
set currentLightState to last light state
if name of currentLightState = “Default” then
make light state with properties {name:”LightOn”, state type:steady, brightness:1.0}
else
repeat until (count of light states) = 1
pop light state
end repeat
end if
end tell
end tell
This script tells the PowerMate with the name “PowerMate” to turn the light on steady with a brightness of 1.0 if it is in the “Default” state (which should you would set to Off in the app). Or if it is already on, it pops any light states off until it gets back to the Default state.
Hi Casey
I have a couple of apps that aren’t recognised by Powermate. Can you tell me what might cause this? In particular, I use an app called Studio Artist from Synthetik and wanted to have PM send keystrokes to it. Is it something in the Info.plist?
I’ve asked the developer if he can test it – but it will probably be much easier if I can tell him how PM accepts an app in a Group.
Thanks for your cool software.
You’re welcome! 🙂 Keystrokes are sent to whichever app is active, so as long as the Studio Artist app is the active app it should “just work”.
I’m not a fan of the light, is there a way to tell it to stay off all the time?
I only have the standard “Default Set”, within that set the “Default Light State” is set to “Off”. If I put my Mac to sleep then wake it up, the light comes on. I have to go back to the “Main Window”, then check & uncheck the ‘Assign’ checkbox to switch the light off again.
Similarly, launching PowerMate 3.0 after reboot does not switch the light off as expected.
Hi Casey. Thanks for the app and this resource. I’ve tried to set up scripts to make the light pulse when new mail arrives and then revert back to the previous state after the mail is read but can’t get it to work. I have no Applescript experience and ended up with routines that just made the light pulse all the time after Mail triggered the script. Is there a list of PowerMate 3.0 scripts somewhere I can go to to copy something? Could I have one of yours? Many thanks, Simon
This is what I’ve tried so far. It’s just a mash of the scripts you made in the Extras folder and something from OS X Hints.
— say “Checking email”
set shouldContinue to 1
repeat while shouldContinue is 1
try
tell application “System Events” to if (exists process “Mail”) is false then
set theCount to 0
else
tell application “Mail” to set theCount to unread count of inbox
end if
if theCount > 0 then
tell application “PowerMate”
— If you only have one PowerMate, just use the first device
set aDevice to first device
— If you have multiple PowerMates, uncomment the following and set the name to the PowerMate to receive the light state
— set aDevice to device named “PowerMate 1”
tell aDevice
set currentLightState to last light state
if name of currentLightState ≠“Slow Pulse” then
make light state with properties {state type:pulsed, pulse rate:0.25, name:”Slow Pulse”}
end if
end tell
end tell
else
tell application “PowerMate”
— If you only have one PowerMate, just use the first device
set aDevice to first device
— If you have multiple PowerMates, uncomment the following and set the name to the PowerMate to receive the light state
— set aDevice to device named “PowerMate 1”
tell aDevice
set currentLightState to last light state
if name of currentLightState ≠“Bright” then
make light state with properties {state type:steady, brightness:1.0, name:”Bright”}
end if
end tell
end tell
end if
end try
delay 2
end repeat
–say “Finished”
In mail I have a rule that executes an AppleScript when new mail arrives. It looks like this:
tell application “PowerMate”
set aDevice to device named “Alt PM”
tell aDevice
set currentLightState to last light state
if name of currentLightState ≠“New Mail” then
make light state with properties {state type:counter, pulse count:3, pulse length:0.1, name:”New Mail”}
end if
end tell
end tell
I don’t use any AppleScripts in the PowerMate app itself. My trigger is set to only execute if “Match Light State” is set to “New Mail”. If that’s true, it opens mail via a Launch Application action and clears the light state using a Clear State action.
Is there a document or list somewhere of all the possible state types and parameters? I’d like to use the “Input Level” light state mode in a script, but can’t find the proper parameters.
There are a collection of scripts that come with the app and I believe those demonstrate all the various light states.
Hmm… I guess that means the “input level” mode available in the PowerMate main window isn’t a state type available to use via script?
Unfortunately no. The available states are: steady/‌pulsed/‌counter/‌morse code. You can also open the Scripting Dictionary from within the AppleScript editor to get the details for all the various AppleScript commands that the PowerMate supports.
Hi Casey. Thanks for this blog post. It has already helped me lots with my new Powermate. I have an idea I hope you can help me with.
I would like to use the Powermate as a tool selector in Adobe InDesign. Each of the tools has a keystroke that activates it. I would like the Powermate to send each of these keystrokes, one at a time, as I turn the knob.
It seems that the Powermate is designed to only send the same key stroke repeatedly as I turn the knob.
I tried creating a custom menu that contains the keystrokes for all the tools I use. This almost accomplishes what I want, but each menu item is simply titled “key stroke” and it doesn’t give any indication of which key stroke is which. It is an onscreen menu, but it doesn’t tell me what I am selecting.
thoughts?
thanks,
Lightning
Hey Lightning, in your menu, you can click on the name of each trigger and rename them to whatever you like. So you could name each “Key press” trigger to the names of the functions they will initiate. Hope that helps!
thanks Casey, that helps a lot. Who knows how long I would have stared at that menu before it occurred to me that I could rename the menu elements.
cheers,
L
Hi Casey, never did get the light to work to pulse for mew mail. I had another crack at it today to see if time had given me inspiration.
Otherwise the Powermate has transformed my workflow. Thanks!
Glad to head it Simon. Hope you get the new mail thing worked out!
Just picked up a PowerMate, enjoying it for scrubbing through animation in After Effects (OSX 10.6.8). I’m having the exact same issues as “Johnnie Walker” above. I would prefer to disable the light altogether, but Powermate forgets this setting once I shut down or put my Mac to sleep. Casey, care to weigh in on this? Is there a way to force the PowerMate to remember it’s light state in between login/sleep sessions? Thanks!