Why do we need rb-appscript? Well, because I prefer not to write a bunch of '/usr/bin/osascript/ -e "tell application \"MyApp\" to blah bla bla"' from Ruby to talk to other applications. Rb-appscript enables us to communicate with scriptable applications through Ruby instead of using AppleScript. It is very, very cool and if you are needing to script applications then I suggest you try it. My many thanks to Hamish Sanderson for creating it! Click here for more information.
Installing as a Gem All of the examples on this website assume you have installed rb-appscript from source. If you install as a gem instead make sure you add require 'rubygems' above the appscript require statements.
sudo gem install rb-appscript
This snippet on how to install rb-appscript was taken from Downloading and Installing Appscript for Ruby, an article by Matt Neuburg. If you are not familiar with rb-appscript, and even if you are, I highly recommend reading Matt's article. You will most likely learn something!From:Downloading and Installing Appscript for Ruby, by Matt Neuburg
Presumably you're already up and running with Ruby. Although rb-appscript is available as a Ruby gem, I prefer manual installation from source. Obtain the latest build from RubyForge. The file you want to download is the source .zip file. (At the time of writing, it was called "rb-appscript-0.5.1.zip.") Unzip the archive, cd into the unzipped directory in the Terminal, and type:To test, use your favorite Unix script-running environment, and create and execute this script:$ ruby extconf.rb $ make $ sudo make install#!/usr/bin/env ruby require "appscript" include Appscript puts app('Finder').name.get