pere.noel
9/7/2006 5:46:00 PM
Phrogz <gavin@refinery.com> wrote:
> I'm sure I'll never finish it, but the point of this post is to find
> out if anyone smarter than me knows about Ruby and OSA, and knows what
> it would take to at least START a Ruby OSA.
that's easy :
--- truc.rb ------------------------------------------------------------
#!/usr/bin/env ruby
require 'osx/aeosa'
as="tell application \"Finder\"
activate
set my_folder to version choose folder
set my_folder to POSIX path of my_folder
end tell
my_folder"
puts OSX.do_osascript(as).to_rbobj
------------------------------------------------------------------------
provided you have installed RubyAEOSA.
other solution if you don't want to install RubyAEOSA.
u'll have to files one "choose_folder.applescript" call by the other
"run_applescript.rb" :
--- choose_folder.applescript ------------------------------------------
tell application "Finder"
activate
set my_folder to version choose folder
set my_folder to POSIX path of my_folder
end tell
my_folder
------------------------------------------------------------------------
--- run_applescript.rb -------------------------------------------------
#!/usr/bin/env ruby
puts r=`osascript choose_folder.applescript`.chomp
------------------------------------------------------------------------
--
une bévue