How many languages does it take to change a Keynote slide?
I was playing with Telekinesis on Friday, which lets you use an iPhone as a remote control for your Mac. The idea is simple: Telekinesis runs a web server on your machine, and the iPhone connects to it. It ships with a few Telekinesis Applications (or “tapps”), or you can write your own to control your own programs.
I wrote one to control Keynote presentations from your iPhone. It’s fairly simple: it shows you the current slide and the presenter’s notes for that slide, and it lets you go forward and backward through your slide deck. (No, it’s not release-quality yet, but expect it in a few days.)
So here’s the real meat of this blog post: (Warning: geeky-acronym-land ahead.)
- Being a Mac OS X app, Telekinesis’s UI is written in Objective C.
- It exposes a web server that can run PHP scripts.
- My remote application is a set of PHP scripts that sit on the Mac and run when the iPhone user launches the app.
- On the iPhone, the user makes a request to the PHP script, that generates HTML, CSS and JavaScript to format the page for the iPhone
- To capture the current slide, I use a command line program (
screencapture) inside a shell script from within PHP. - I resize the large slide for the iPhone using another shell script, and push it out to the phone as a stream of bytes, via PHP.
- To change slides, the user clicks the Next and Previous functions on the iPhone, which use AJAX (JavaScript, XML, XmlHttpRequest) to send the request to a PHP script;
- the PHP script interprets this request, and wants to use AppleScript to ask Keynote to update the current slide. But since there is no direct way to invoke AppleScript from PHP, we use the command-line tool
osascriptin a shell script to run our AppleScript. - Keynote hears the call to action from our AppleScript, and changes the slide.
So, our champion team now includes the following players: Objective C, PHP, HTML, CSS, JavaScript, Shell Script, and AppleScript: all with the single goal of changing a Keynote slide.
Has anyone changed lightbulbs with an iPhone yet?
You should try out Salling Clicker (http://www.salling.com/Clicker). Gives you full control of a Mac or PC from your phone over either Bluetooth or WiFi. No iPhone version though.
Rahul — September 30, 2007 @ 10:45 am
Yeah, I’d tried that. It didn’t work with my earlier Samsung phone either. Looks like they only support certain phone models, no J2ME.
Manas — September 30, 2007 @ 11:58 am
Hello there!
I was just wondering if what you’ve got so far is “good enough” yet (that is, not crash during the middle of presenting). I have a presentation in a speech class I am taking in school tomorrow (though I suppose it’s technically today now), and this is exactly what I was looking for. Any way I could be a tester?
Jesse — October 1, 2007 @ 2:46 am
Any News? did you get it ready? need more testers? i want this thing bad….=-)
Braden — January 9, 2008 @ 3:06 am