Presentation Remote
In the last few months I have been using my MacBook to give presentation, both at work and not. I've been meaning to buy one of those presenter remotes. I even got to borrow one and tried it once and I must say it worked pretty well.
Then I remembered that the MacBook came with that useless remote that I had forgotten in a junk drawer somewhere. Well, that remote happens to work well with more than just Front Row. I heard it works with Keynote for presentations. I don't use that application and I'm not planning to buy it since Powerpoint 2007 works very well for me on my PC and I'm too cheap to buy Keynote.
I typically save my PowerPoint presentations to PDF and show them on the mac using Preview (a simple PDF viewer). The remote does not work with Preview out of the box but I found this little freeware called iRed Lite that can make the apple remote control just about any application, as long as the application is controllable with AppleScript, which most apps are.
The only problem was that iRed Lite came with support for Preview but it did not work well for the full screen mode, which I needed. Time to get my hands dirty with AppleScript.
The idea here was to bind the commands associated with the left and right arrows of the remote to the keys PageUp and PageDown, respectively.
The iRed Lite utility allows you to edit each command by assigning a keystroke or an AppleScript snippet. Initially I tried the keystroke alternative but I could not figure out how to send a PageDown or PageUp to the application because on the keyboard they are Fn+UP and Fn+DOWN and Fn was not available in the utility. The AppleScript ended up being rather minimal, as seen in the screenshot.
For the Next Page command I entered:
tell application "System Events" to key code 121
For the Previous Page command I entered:
tell application "System Events" to key code 116
You can find all these key codes in the file /System/Library/Frameworks/Carbon.framework/Frameworks/ HIToolbox.framework/Headers/Events.h provided you installed the developer tools from the OS X installation DVD, i.e. you have Xcode installed.
Wow. All this trouble to save $50? I guess I just liked the fact that I found a use for that remote. Now I just need to hack a laser diode inside the remote to use as a pointer too.