Joris Kluivers

I like to build software.

RubyOSA on Rails

As posted before, I’m currently playing with with Ruby on Rails a lot. While doing so I discover more and more about the beauty of Ruby programming on Mac OS X (with or without rails). For example using the Ruby/Objective-C bridge it’s possible to use any Cocoa Framework in a Ruby script. Even better, Apple seems to like Ruby and already made it clear Ruby on rails will be included in the next version of OS X.

So while searching for Ruby and OS X using google I found another useful gem: RubyOSA, a Ruby/AppleScript bridge. The bridge makes it possible to use any scriptable application as an object in your script.

The RubyOSA website gives a simple example of using Ruby to control iTunes. As an experiment I created a Rails application to do the same, but from a remote location. Not very useful on a live website because RubyOSA commands might take some time to execute. But combined with a wifi enabled phone or pda it results in a nice remote control for iTunes in a home network.