Controlling Plazer with Salling Clicker
Salling Clicker is an intriguingly powerful application that lets Bluetooth-enabled mobile phones interact fruitfully with a Macintosh.
I thought it would be an interesting experiment to see if I could user Salling Clicker to control my Plazes status using the new Plazer application for the Mac. Turns out it was very easy. This is a step by step guide.
Step 1: Enable access for assistive devices
Because the OS X Plazer application doesn't support AppleScript directly, we've got to use GUI Scripting to control the application's menus. This is actually quite easy -- maybe even easier than if there was a Plazer AppleScript dictionary.
GUI Scripting requires that "access for assistive devices" be turned on in the Universal Access System Preferences screen; open System Preferences, select Universal Access, and make sure that this checkbox is checked on.
Step 2: Set up the Plazer AppleScript
I'm assuming that you've already downloaded and installed [Salling Clicker and configured it for use with your mobile device. Don't bother going any further until you've done this; before proceeding, the Salling Clicker pane in System Preferences should say something like T610: Connected at the top (T610 in this case is the name of my device).
Next, select the Phone Events tab within the Salling Click pane, and click on the little "hear" icon at the bottom of the pane and select New Script to create a new script:
Next, type the name of the new script in the field that appears -- something like "Set Plazes Status" is a good choice. Then highlight the new script, and select Edit in Script Editor:
The Script Editor application will open. By default, new Salling Clicker scripts open with a template of AppleScript code that's useful because it contains hooks for all of the "events" that can happen -- incoming call, etc. In our case, it's the entering proximity and leaving proximity events that we're interested in -- these "fire" when your Bluetooth device enters and leaves the range of your Mac.
The easiest thing to do at this point is to highlight all of the text in the template, delete it, and replace it with this AppleScript:
using terms from application "SEC Helper" on process entering proximity a_terminal --- Remember, this is just an example… tell application "SEC Helper" show screen message (bluetooth name of a_terminal) & " entered proximity!" end tell tell application "Plazer" activate end tell tell application "System Events" tell process "Plazer" tell menu bar 1 tell menu bar item "Plazer" tell menu "Plazer" click menu item "Connected" end tell end tell end tell end tell end tell end process entering proximity on process leaving proximity a_terminal --- Remember, this is just an example… tell application "SEC Helper" show screen message (bluetooth name of a_terminal) & " left proximity!" end tell tell application "Plazer" activate end tell tell application "System Events" tell process "Plazer" tell menu bar 1 tell menu bar item "Plazer" tell menu "Plazer" click menu item "Not Connected" end tell end tell end tell end tell end tell end process leaving proximity end using terms from
Click Compile in the Script Editor to make sure everything is pasted in correctly, then save the script and exit the Script Editor.
Step 3: Watch it Work!
That's it! You should find now that when your mobile device "enters proximity" -- i.e. comes within Bluetooth range of your Mac -- that the AppleScript fires, you see a message like this on the screen:
...and the Plazer application should start (if it's not running already) and automatically set your status to Connected:
Conversely, if you take your Bluetooth device out of range, your Plazes status should magically become Not Connected.
It's amazing to watch once it's worked.