# \[ann\] Ruby appscript 0.1.1 released

**URL:** <https://rubytalk.org/t/ann-ruby-appscript-0-1-1-released/31806>\
**Category:** ruby-talk\
**Created:** [11 October 2006 22:35 UTC](https://rubytalk.org/t/ann-ruby-appscript-0-1-1-released/31806 "2006-10-11T22:35:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![has](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@has](https://rubytalk.org/u/has)\
**Post date:** [11 October 2006 22:35 UTC](https://rubytalk.org/t/ann-ruby-appscript-0-1-1-released/31806/1 "2006-10-11T22:35:11Z")

</div>

Announcing the first public release of Ruby appscript, a high-level,  
user-friendly Apple event bridge that allows you to control scriptable  
Mac OS X applications using ordinary Ruby scripts.

[http://rb-appscript.rubyforge.org/](http://rb-appscript.rubyforge.org/)

Appscript makes Ruby a serious alternative to Apple's own AppleScript  
language for automating your Mac. Here's a quick example:

require "appscript"

AS.app('TextEdit').documents.end.make(  
&nbsp;&nbsp;&nbsp;&nbsp;:new =\> :document,  
&nbsp;&nbsp;&nbsp;&nbsp;:with\_properties =\> {:text =\> "Hello World!\n"})

Ruby appscript is a port of the popular Python appscript package  
\<[http://appscript.sourceforge.net/](http://appscript.sourceforge.net/)\>, so while this initial release may  
lack a little polish in places, it's based on a mature, well-proven  
architecture that has been developed, tested and refined over several  
years. As a result, rb-appscript 0.1.1 offers a level of power,  
robustness and performance that is already very close to  
py-appscript's, with further improvements to come.

The rb-appscript package includes additional example scripts,  
documentation and a tutorial, and can be downloaded from:

[http://rubyforge.org/frs/?group\_id=2346](http://rubyforge.org/frs/?group_id=2346)

Forums for discussing rb-appscript are also available. Questions, bug  
reports, suggestions for improvements, etc. will all be very welcome.

Enjoy!

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [11 October 2006 22:51 UTC](https://rubytalk.org/t/ann-ruby-appscript-0-1-1-released/31806/2 "2006-10-11T22:51:51Z")

</div>

Could you explain what the differences are with ruby aeosa? Below is an example from the website:

require 'osx/aeosa'  
app = OSX::AEDesc.application "Internet Explorer"  
app.open\_docs "html/INDEX.en.html"  
app.activate  
app.quit\_app

[http://www.fobj.com/rubyaeosa/](http://www.fobj.com/rubyaeosa/)

> **···**
>
> On Oct 11, 2006, at 3:35 PM, has.temp3@virgin.net wrote:
> 
> > Appscript makes Ruby a serious alternative to Apple's own AppleScript  
> > language for automating your Mac. Here's a quick example:
> > 
> > require "appscript"
> > 
> > AS.app('TextEdit').documents.end.make(  
> > &nbsp;&nbsp;&nbsp;&nbsp;:new =\> :document,  
> > &nbsp;&nbsp;&nbsp;&nbsp;:with\_properties =\> {:text =\> "Hello World!\n"})

---

<div class="post-metadata">

**Author:** ![has](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@has](https://rubytalk.org/u/has)\
**Post date:** [12 October 2006 16:35 UTC](https://rubytalk.org/t/ann-ruby-appscript-0-1-1-released/31806/3 "2006-10-12T16:35:08Z")

</div>

rb-appscript-0.1.2 has just been posted:

[http://rubyforge.org/frs/?group\_id=2346&release\_id=7361](http://rubyforge.org/frs/?group_id=2346&release_id=7361)

This release fixes a bug where enumerator values returned by  
applications were being unpacked incorrectly.

---

<div class="post-metadata">

**Author:** ![has](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@has](https://rubytalk.org/u/has)\
**Post date:** [12 October 2006 00:20 UTC](https://rubytalk.org/t/ann-ruby-appscript-0-1-1-released/31806/4 "2006-10-12T00:20:11Z")

</div>

Ryan Davis wrote:

> Could you explain what the differences are with ruby aeosa?

Appscript is a much, much higher-level bridge for creating and sending  
Apple events. Constructing complex commands and references in aeosa  
requires a detailed understanding of the low-level Apple Event Manager  
API and lots and lots of grungy code.

For example, just getting the text of the front TextEdit document in  
aeosa involves writing:

require 'osx/aeosa'

app = OSX::AEDesc.application("TextEdit")  
app.ae\_send\_mode = 3

query = OSX::AEDesc.record({  
&nbsp;&nbsp;'want' =\> OSX::AEDesc.new('type', 'prop'),  
&nbsp;&nbsp;'form' =\> OSX::AEDesc.new('enum', 'prop'),  
&nbsp;&nbsp;'seld' =\> OSX::AEDesc.new('type', 'ctxt'),  
&nbsp;&nbsp;'from' =\> OSX::AEDesc.record({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'want' =\> OSX::AEDesc.new('type', 'docu'),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'form' =\> OSX::AEDesc.new('enum', 'indx'),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'seld' =\> 1,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'from' =\> OSX::AEDesc.null})}).coerce('obj ')

p app.ae\_send('core', 'getd', query).coerce('reco').  
to\_rbobj['----'].to\_rbobj

Pretty hairy stuff (and even after a half-hour's troubleshooting I  
still couldn't get it to work correctly for some reason).

With appscript, you just write:

require "appscript"

p AS.app("TextEdit").documents[1].text.get

Constructing the application object model query, translating  
human-readable terminology to four-character codes, and packing and  
unpacking Ruby values is all handled automatically, and the whole lot's  
wrapped up in a very user-friendly OO-like syntax.

HTH
