In this example, I'm going to make the extra buttons on the left and right of the mouse go backwards and forwards in Safari and Finder, but change the brush size in Photoshop.
Start by adding the Control Flow action If Then Else. Pick All Of The Following Are True and choose This Application: Safari Is At The Front and the action to Interface Control, then Type A Keystroke; press Command-Left Arrow. This is the shortcut to go backwards in Safari.
For Finder, add another identical action but choose Finder and make the keystroke Command-[.
Now add another If Then Else action with the same conditions, but pick Adobe Photoshop as the app and set the keystroke to [ (the default shortcut for reducing the brush size in that app).
Repeat the same procedure in a new macro for any other buttons. The same thing works for special buttons on keyboards that don't have a set function in OS X, and even for some buttons on other USB accessories. As long as Keyboard Maestro detects the press of a button, you can use it.
Use MIDI devices to control your Mac
This tip is a little more out there, but if you make music with your Mac, either for fun as an amateur with Garageband or professionally with Logic Pro or other pro apps, you probably have a MIDI keyboard of some kind. These are great for making music, but can actually be used with any app if you have Keyboard Maestro.
The trigger you're looking for is called MIDI Trigger. Pick This Midi Note and just play a note on the keyboard. You should usually choose any device and any channel to make sure your macro triggers no matter which port you've plugged the keyboard into and what channel it's set to.
With a full-size keyboard, you have enough keys to make shortcuts to all menu items in every app you're likely to use. You could even start color coding or labeling the keys for these extra functions.
Apart from making easy to access one-key shortcuts, you can also use this trigger to write notes even if you don't have a music app that does it for you. Make a macro in a group restricted to, say, Microsoft Word, and make it write down the notes you're hitting while playing on the keyboard.
But, wait, there's more! Here are a few ideas for other Keyboard Maestro macros that you could assemble yourself.
Pull a prank: Install Keyboard Maestro and set a macro to run every time the user presses some common keyboard shortcut, such as Command-Q. Make it run an Applescript that does something spooky but totally harmless, such as: say "I'm sorry Dave, I'm afraid I can't do that".
Sign up for Computerworld eNewsletters.