Merging Scripting Additions

You may want to call commands defined in Scripting Additions terminologies. A popular one is StandardAdditions, delivered in Mac OS X as /System/Library/ScriptingAdditions/StandardAdditions.osax.

To do this, call #merge on your application object:

app ='iTunes')
puts app.choose_file

The StandardAdditions API will be merged into the application object, allowing you to call new methods on it.

The example above will ask iTunes to emit a beep, then to present the file chooser window. The chosen path will be printed to the standard output on success, otherwise an exception will be raised (e.g., if the user cancels the window).

The #merge method works like You can also provide either the signature, bundle ID or full path to a scriptable addition by using the options :signature, :bundle_id or :path respectively.

RubyOSA's rdoc-osa tool has the ability to generate documentation for Scripting Additions.