Oct 19, '06 07:30:00AM • Contributed by: Froderick
Griffin AirClick USB is a pretty fantastic fully programmable USB remote. Each button essentially launches an AppleScript of your choosing. The beauty of the AirClick program is that it's actually really easy to add just about any application you want, with any functionality you can achieve via AppleScript.
It comes with a bunch of built-in programs supported, such as iTunes, VLC, QuickTime, iMovie, PowerPoint, etc, so you don't have to worry about those. But what about unusual programs like Artstor OIV, which has a very unusual slide-advancement control scheme (whoever heard of space to go forward, shift-space to go backward??).
There is a very good guide to modifying AirClick (Part I and Part II) on the Some Geek in Tennessee site. I thought I'd build off of his work and make something a bit more step-by-step.
This is how to add your own programs and your own AppleScripts to do pretty much anything you want. The example scripts that I write here are to make Artstor OIV advance slides when pressing the appropriate button.
Things you'll need:
- Obviously, the AirClick remote, USB receiver, and the software. The software consists of a program called AirClick that adds a menu item to the top right of your menubar and allows you to use the functionality within. NOTE: the software on the CD is an older version. You will want the newer version, which is quite different inside.
- Either a good text editor (such a BBEdit) or, better yet, Apple's Property List Editor (which is installed with the Developer Tools), to work on the functions.plist file. There is a program called PlistEdit Pro, which supposedly is the best use for this, but I haven't ever used it and can't vouch for it. To each his own, however, so use whatever is most convenient.
- Apple's Script Editor application for working with AppleScripts. While XCode has a better interface for this, it's fairly overkill for the simplicity of what we're doing here.
The basic premise is fairly simple. Inside the AirClick bundle (control-click on the app and choose Show Package Contents), navigate to Contents/Resources. There are two things here that matter to us: the functions.plist property list, and the folder named scripts, which contains all the AppleScripts that make things work.
First, open functions.plist in Property List Editor. You can also do this through any straight text editor, though you end up having to sort through a lot of text, which can be rather foreboding if you aren't familiar with markup-style formatting, such as HTML or XML (which this uses). The entire goal of this section is to make a new entry that looks completely identical to the other ones, except that the AppleScripts are different (along with one or two minor settings here or there). We're going to manually add in each new part of the new entry using Property List Editor, and I'll explain everything step by step.
- Add the new application entry In Property List Editor, click the arrow next to the Root level. You'll see a list of numbers, each with little arrows. Each of these numbers represents an application that is being serviced by AirClick. To add a new one, click on one of the numbers with an arrow next to it and hit the New Sibling button on the top left.
This will automatically numerate a new addition. By default, this new class of sibling is a string, which we don't want. Click the word string in the class column and change it to Dictionary (basically this needs to be exactly like the others).
Within each entry are going to be three children: the AppBundle, the Functions array, and the Name string. The AppBundle is used to get the right icon for the application, the Functions array allows you to define what AppleScript will run when you hit one of the buttons, and the Name string is the name of the program as it appears in AirClick's menu. - Add the first child, the AppBundle Click the little arrow next to the new entry, and click New Child (which has replaced the New Sibling button). Change the name (left side) of the string to AppBundle. Change the value (right side) to the name of the AppBundle of whatever application you want to add. If you don't know what the AppBundle name of a given application is, get its package contents and look at the info.plist inside.
The only purpose to adding the AppBundle name is for it to pick the right icon to display for certain scripts or messages. It doesn't use it for anything else. You could potentially make PowerPoint use the iTunes icon, if you were so inclined. - Add the second child, the Functions array Clicking on the numbered entry once again, click the New Child button again. This time, change the Class of the child to Array instead of String. Change the name of it (the left side) to Functions. This new child should now have one of those little arrows next to it. Click the arrow (so that it points down) and click the New Child button. This will add a child underneath the Functions header, which will be known as 0 (zero).
Change 0 to a Dictionary. This will give it a little arrow next to it as well. Click the arrow to point it down, and then click the New Child button again. This child should be a Number (not a String), and the name (left side) should be Button.
The Value (right side) should be either 1, 2, 4, 8, or 16. These numbers correspond to a given button on the remote as follows:- Play: 1
- Volume Up: 2
- Volume Down: 4
- Next: 8
- Previous: 16
Click on the Button item and click the New Sibling button. Do this until you have 8 total items underneath the 0 Dictionary. They should be, in this order, in this class format:- Button - Number
- Modifiers - Number
- Name - String
- OnRelease - Boolean
- Repeats - Boolean
- Scriptname - String
- ShowInMenu - Boolean
- Time - Number
- Add the third child, the Name string Click on the large number of the new entry (i.e. something like 15 or 16), the one above AppBundle. Click on New Child and change it to a String. The name should be Name, and the value should be whatever the name of the program is as you want it to appear in the menu.
- Fill out the data for the Functions Now that you have the layout of an entry properly done, you can start filling out the data and settings you want. Using the guide linked at the beginning of this document, you can make the buttons do just about whatever you want. For our purposes, I'll take you through the setup of two basic functions: Next Slide and Previous Slide. Change the settings for Entry 0 as follows:
- Button - 8 (the Forward button)
- Modifiers - 0
- Name - Previous
- OnRelease - No
- Repeats - Yes
- Scriptname - art_next.applescript
- ShowInMenu - Yes
- Time - 0
Do the same with the Previous button by setting the Button value to 16, and changing the Scriptname to art_next.applescript. - Save and quit, and into Applescript we go Save your work and quit AirClick. Now, we're going to add two scripts into the scripts folder in the same location that functions.plist is in. To do this, open up Apple's ScriptEditor program (which comes standard with every Mac OS X install). Write this out into ScriptEditor exactly:
As was said in the linked guide above, go to Save As. Make sure that you select Text for the File Format menu. The Line Endings should be UNIX (LF) as well. Make sure that when you save it, you save it as art_next.applescript. You may be asked to locate the application you are modifying -- just scroll through the list to find it.tell application "OIV" activate tell application "AirClick" simulate ascii key code 32 end tell end tell
Make another one and do something similar:
Save this one as art_prev.applescript. Again, make sure it is text. Both of these two AppleScripts should be saved (or moved) into the scripts folder that we saw above, inside the AirClick package.tell application "OIV" activate tell application "AirClick" simulate ascii key code 32 modifiers {"shift"} end tell end tell - g) Change permissions on the script There's one last tricky part: changing the executable permissions of the script. Open up the Terminal (in Applications/Utilities). Type in, exactly:
Then press the Space Bar, do not hit Return, and drag one of the scripts from the Finder into the Terminal window. It will automatically fill the rest out. Hit the Return key to make the change. Do it again with the other script, then close the Terminal.chown +x - Make any other changes You should now have a basically working copy of AirClick able to modify ArtStor OIV. To test this out, start a presentation in OIV and then use the remote to see if it works or not. Once you have the basics running, you should now be able to add the other buttons and other features.
