Hi,
has someone experiences with RubyOSA – a Ruby/AppleEvent Bridge (esp. whether it is faster than osascript running in BASH)?
-Hans
On Jan 04, 2007, at 10:04, Hans-Joerg Bibiko wrote:
Hi,
has someone experiences with RubyOSA – a Ruby/AppleEvent Bridge (esp. whether it is faster than osascript running in BASH)?
-Hans ______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
You might also check out rb-appscript, ported from python.
On Thu, Jan 04, 2007, Jordan Breeding wrote:
You might also check out rb-appscript, ported from python.
While I do suggest you check this out, I want to point out that RubyOSA is actually being written by Apple, and is also insanely cool ;)
As to whether it's faster, I think it probably depends a lot on whether you've already got a Ruby interpreter up and running. If you're using RubyOSA to send events from an existing Ruby process, it's likely faster than shelling out to osascript.
That said, the difference is probably negligible. RubyOSA is a joy to use, but I have not tried rb-appscript so it may be as well :)
Ben
On 1/4/07, Ben Bleything ben@bleything.net wrote:
While I do suggest you check this out, I want to point out that RubyOSA is actually being written by Apple, and is also insanely cool ;)
Not only it's being written by Apple, it also seems to be the foundation for the Ruby-AppleScript bindings in Leopard[1]
I haven't used rb-appscript (downloading right now!) but some toying with RubyOSA has made me quite happy (I ported a quite complex script to Ruby and now it looks really nice).
Keep in mind, though, that RubyOSA is still not ready for prime time. System events and ScriptAdditions (the cool "display dialog" part in AppleScript) are not available yet, and this may limit what you can do. You may look into tm_dialog as a replacement for ScriptAdditions, but then you'd have to distribute it with your script (I'm thinking about general-purpose script, not only TM-related stuff)
Just my .02
[1]: http://theocacao.com/document.page/373
-- Ale Muñoz http://sofanaranja.com http://bomberstudios.com
Ben Bleything <ben@...> writes:
While I do suggest you check this out, I want to point out that RubyOSA is actually being written by Apple, and is also insanely cool ;)
Not so cool here. When I try to build from source rubyOSA, I get the error "can't find header files for ruby"... Right, so where did Mother Apple put the header files for ruby? my installation is 100% standard...
Piero
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On 05.01.2007, at 18:18, Piero D'Ancona wrote:
Ben Bleything <ben@...> writes:
While I do suggest you check this out, I want to point out that RubyOSA is actually being written by Apple, and is also insanely cool ;)
Not so cool here. When I try to build from source rubyOSA, I get the error "can't find header files for ruby"... Right, so where did Mother Apple put the header files for ruby? my installation is 100% standard...
Piero
I just searched and found a ruby.h here: /usr/lib/ruby/1.8/universal- darwin8.0/ruby.h But I'm not sure if this is by standard there or the correct header file because I got some problems with the standard ruby (couldn't find the header file too) and so I compiled and installed the newest version from http://ruby-lang.org myself. Hope this helps, Simon - ----
privacy is necessary using http://gnupg.org public key id: 0x6115F804EFB33229 http://ruderich.com/
simonruderich.asc
Hans-Joerg Bibiko wrote:
has someone experiences with RubyOSA – a Ruby/AppleEvent Bridge (esp. whether it is faster than osascript running in BASH)?
Hmm, well it probably depends on what you're doing. Both of them probably have to look up an application's dictionary when they run, because they work based on keywords rather than on the actual apple event codes (though it's possible RubyOSA caches the translation somewhere. I have no idea). But for doing string transformations, numerical stuff, or anything more complicated, RubyOSA should be much faster than applescript, which is dog slow when it has to be compiled as part of the run process, as it is with osascript via bash. But if you compile an applescript first, and then run it via osascript, you might end up faster than RubyOSA, because at that point, it doesn't have to do any lookups at all, and can just send Apple Event codes straight to the target app.
In other words, try all 3 ways, and test the speed. :)
-Jacob