RubyOSA is a bridge between Ruby and the Open Scripting Architecture (OSA). The key idea is to create a Ruby API on the fly based on a target application’s scriptable definition.

Once you target an application with RubyOSA you get a special kind of proxy object, which is the entry point of the generated Ruby API.

Let’s start with something easy:

require ‘rbosa’ # (1)
app = OSA.app(‘iTunes’) # (2)
puts app.current_track.name # (3)
First, we need to require the RubyOSA bridge

**Note that if you installed RubyOSA via RubyGems you might want to require ‘rubygems’ before.