rb-appscript

1. Introduction

About osax

The OSAX module provides an easy way to call scripting additions (a.k.a. OSAXen) from Ruby. It exports a single public class, ScriptingAddition, and two functions, osax and scripting_additions.

The ScriptingAddition class represents a single scripting addition. It is similar to an appscript application object, except that it defines commands for the specified scripting addition instead of the application's normal commands.

Once you've created a ScriptingAddition instance, you can invoke its commands in exactly the same way as you would call a scriptable application's commands in appscript.

For example:

require "osax"

sa = OSAX::ScriptingAddition.new("StandardAdditions")

sa.say("Hello world", :using=>"Victoria")

The default application commands (run, activate, quit, etc.) are also available; see the appscript manual for details on those.

By default, ScriptingAddition objects are targeted at the current application. You can obtain a ScriptingAddition object targeted at another application by calling one of its by... methods.