From: Stephen Schor Date: 2007-12-26T08:29:07+09:00 Subject: Re: Automating OS X with Ruby. ------=_Part_7668_24083052.1198625352931 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for all the replies. Calling .activate() isn't working for me...but opening it though the shell with system("open -a 'itunes'") will work for now. Here's a snippet from the IRB session: >> require 'rbosa' => true >> i_chat = OSA.app('iTunes') => >> i_chat.activate RuntimeError: Cannot send Apple Event 'miscactv' : procNotFound (-600) from /Library/Ruby/Gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:796:in `__send_event__' from /Library/Ruby/Gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:796:in `activate' However - after a bit of searching I found what looks to be a related post by *Laurent Sansonetti *in Rubyosa mailing list. (http://mail.google.com/mail/?hl=en&tab=wm#inbox/1170f53ede402ae8) about why calling OSA.app('blah') on certain applications won't launch them. -Stephen On Dec 25, 2007 5:08 PM, Dane Jensen wrote: > On Dec 25, 2007, at 3:55 AM, Ryan Davis > wrote: > > > > > On Dec 24, 2007, at 19:23 , Stephen Schor wrote: > > > >> However - I can't interact with the *itunes* object unless I > >> manually open > >> the application. > >> After I manually open it - I can call nifty methods like itunes.play > >> () and > >> itunes.stop(). > >> I tried calling itunes.open() but that wouldn't launch the > >> application. > > > > I dunno about rubyosa, but applescript uses 'activate'. > > Indeed. itunes.activate will start it if it's not open. > > > ------=_Part_7668_24083052.1198625352931--