About rb-appscript

Ruby appscript (rb-appscript) is a high-level, user-friendly Apple event bridge that allows you to control scriptable Mac OS X applications using ordinary Ruby scripts.

For example, to get the value of the first paragraph of the topmost document in TextEdit:

app('TextEdit').documents['Read Me'].paragraphs[1].get

This is equivalent to the AppleScript statement:

tell application "TextEdit"
    get paragraph 1 of document "Read Me"
end tell

Rb-appscript requires Ruby 1.8+ and Mac OS X 10.3 or later.

Notes

Ruby appscript (rb-appscript) is a port of the original py-appscript bridge. There are a few minor syntax and API changes to accomodate the differences between the two languages, but they are otherwise very similar.

Please note that while rb-appscript uses regular object-oriented Ruby syntax, because it's a bridge to the query-driven Apple Event Manager there are some differences in how it behaves. Check the appscript manual for more information.