Introduction
TouchMe is a little app I knocked up to control my media server (a Mac mini) from my iPhone or an iPod Touch. It uses my SimpleHTTPd Cocoa web server to serve a webapp to connecting clients.
Plugins for various applications are written as XML files containing AppleScript commands that are executed on the server to control their respective applications. The plugins are loaded by a System Preferences panel.
Download
Source is included in the download. This application requires Mac OS 10.5 Leopard or above as it uses features of Objective C 2.0 including the garbage collector.
- TouchMe 3.8MB
Installation
Double click the DMG and drag the application to your desktop or /Applications directory. Double click the preferences panel to load it into your System Preferences application.
Finally, use the preferences panel to import plugins from the plugins folder and start/restart the application.
Usage
By default TouchMe runs on port 9001 on the server. It advertises itself via Bonjour Bookmarks (a bookmark menu in Safari) so connecting from a desktop machine should be quite straightforwad, however currently Mobile Safari does not support Bonjour Bookmarks (although I believe it’s slated for version 2 of the firmware) so you’ll have to key in the IP address manually.
It is not currently possible to change the port TouchMe runs on but I may add it in a later release if it is requested.
Once you have accessed the page it presents a list-style interface that should be familiure to iPhone/iPod Touch users.

Writing plugins
Plugins are simply XML files with a different extension. Open the file in a text editor (I like Smultron but TextEdit will do - just make sure to turn off text formatting) and ensure that it looks similar to the following:
-
<?xml version="1.0"?>
-
<plugin>
-
<name>iTunes</name>
-
<description>Play it loud, OK?</description>
-
<version>0.1</version>
-
<application>iTunes</application>
-
<command>
-
<name>Play/Pause</name>
-
<exec><![CDATA[ tell application "iTunes" to playpause ]]></exec>
-
</command>
-
<command>
-
<name>Next track</name>
-
<exec><![CDATA[ tell application "iTunes" to next track ]]></exec>
-
</command>
-
<command>
-
<name>Previous track</name>
-
<exec><![CDATA[ tell application "iTunes" to previous track ]]></exec>
-
</command>
-
</plugin>
The contents of the name tag should be unique within TouchMe as it’s used to build the menu structure.
description is used to give a sub heading and version to keep track of, well, the version number - it’s displayed in the System Preferences application.
application should be the name of the application that the plugin controls (without the .app extension) and is used to start, stop and force quit the application.
The available AppleScript commands are defined by any number of command tags. The name tag is displayed in the interface and the contents of the exec tags are internally passed to the command line osascript program to actually execute the command. Multi line scripts are supported. Wrapping the AppleScript in CDATA tags is optional but is advised.
The commands are passed in as-is so while it’s technically possible to control more than one application from a plugin that sort of thing is discouraged.
When you are done editing, save the file with the extension .touchme and use the System Preferences panel to import your new plugin - TouchMe should then be restarted automatically. Reload the page in Safari and try it out.
If you come up with a neat plugin, send it to me and I’ll create a page for them.
Changelog
Version 0.2
Initial release
Version 0.1
Internal testing version
Popularity: 1% [?]