On Friday, September 19, 2008, at 02:10PM, "Laurent Sansonetti" <lsansonetti@apple.com> wrote:
On Sep 19, 2008, at 11:47 AM, Jordan K. Hubbard wrote:
On Sep 19, 2008, at 6:22 AM, Richard Kilmer wrote:
I added the ability to easily support notification posting and subscribing in HotCocoa:
Nice! Very nice!
This makes me wonder though... Since we're now into the area of inter-application messaging, how might the ScriptingBridge APIs look once suitably "HotCocoa'd"? More concise than RubyOSA, I'd imagine, and perhaps capable of recapturing some of the ease-of-use we lost when transitioning from RubyOSA to ScriptingBridge... Just a random thought, and aimed mostly at Laurent. :)
ScriptingBridge works as it is under MacRuby. Off the top of my mind, the main advantages compared to RubyOSA are
1) objects returned by SB do not need to be boxed (since they are native!) 2) unicode strings!
As an example, here is a script that lists all songs in iTunes. I have quite a few songs with Japanese titles and they show up perfectly in the terminal.
framework 'ScriptingBridge' itunes = SBApplication.applicationWithBundleIdentifier('com.apple.itunes') itunes.sources[0].playlists[0].tracks.each do |t| puts t.name, t.artist, '---' end
Obviously one could write some HotCocoa mappings for ScriptingBridge. For example, the [SBApplication applicationWithBundleIdentifier:] incantation is just too verbose, compared to RubyOSA's app('iTunes').
It would be a nice idea, though I'm not sure if we would be able to offer the same user experience than RubyOSA, given that all the scriptable APIs are generated on the fly and RubyOSA takes care of creating Ruby-like methods. Also, it is still impossible to access enumerations via ScriptingBridge, because it does not expose them.
I would actually prefer to work on making MacRuby a real OSA language and bundling an OSA bridge similar to RubyOSA in the core.
I like the sound of that. No RubyOSA, no rb-appscript, just have real OSA built directly in. That would be nice. ScriptingBridge is nice for some things, and more tedious for others at the same time (like trying to add artwork to a song in iTunes which doesn't have any currently, or updating artwork in a song). For me, ScriptingBridge is nicer to have in Objective-C (which could also arguably use objc-appscript) than MacRuby (where something even better could end up existing).
Laurent