From maillist at steelskies.com Tue Dec 4 06:00:57 2007 From: maillist at steelskies.com (Jonathan del Strother) Date: Tue, 4 Dec 2007 11:00:57 +0000 Subject: [Rubyosa-discuss] Speeding up this rbosa script? Message-ID: <57518fd10712040300j60302c3cwee8a3c3962066537@mail.gmail.com> Heya, I wrote an rbosa script that jumps between my test files and 'real' files in Xcode - eg hitting ??? to jump between Scheduler.m and SchedulerTests.m and back again. Which works nicely, but it's slower than I'd like, taking maybe 0.5 seconds to jump to the other file. Doesn't sound like much, but it's enough time to start wondering whether it's going to switch or not... -- #! /usr/bin/env ruby require 'rubygems' require 'rbosa' app = OSA.app('Xcode') selected_window = app.windows.first file = selected_window.associated_file_name dir = File.dirname(file) counterpart_file = nil if (file =~ /Tests?\./) #looks like a test file, strip out 'Test' and look for the real counterpart counterpart_file = file.gsub(/Tests?\./, '.') else # OK, it's a real source file. Try and find the test counterpart ext = File.extname(file) basename = file.sub(/#{Regexp.quote(ext)}$/, '') counterpart_file = basename+'Test'+ext counterpart_file = basename+'Tests'+ext unless File.exists?(counterpart_file) #allow 'Test' or 'Tests' suffix end if File.exists?(counterpart_file) app.open(counterpart_file) else app.merge('StandardAdditions').beep end -- Is there anything I can do that might make this a bit more snappy? I'm on 10.5.1, and have libxml installed. Cheers, Jonathan del Strother From maillist at steelskies.com Fri Dec 7 13:11:44 2007 From: maillist at steelskies.com (Jonathan del Strother) Date: Fri, 7 Dec 2007 18:11:44 +0000 Subject: [Rubyosa-discuss] Speeding up this rbosa script? In-Reply-To: <57518fd10712040300j60302c3cwee8a3c3962066537@mail.gmail.com> References: <57518fd10712040300j60302c3cwee8a3c3962066537@mail.gmail.com> Message-ID: <57518fd10712071011s51711980ybd4ca01ee89059c3@mail.gmail.com> On Dec 4, 2007 11:00 AM, Jonathan del Strother wrote: > Heya, > I wrote an rbosa script that jumps between my test files and 'real' > files in Xcode - eg hitting ??? to jump between Scheduler.m and > SchedulerTests.m and back again. > > Which works nicely, but it's slower than I'd like, taking maybe 0.5 > seconds to jump to the other file. Doesn't sound like much, but it's > enough time to start wondering whether it's going to switch or not... > Just for anyone else following this, I ended up switching to rb-appscript. Which is actually impressively quick in comparison - the original code took 0.5s with rbosa, and 0.3s with appscript. rb-appscript also has a nifty Terminology.dump method which dumps the parsed osa gubbins to a file, shaving a further 0.1s off, making things 2.5x faster! From chris.tipper at gmail.com Fri Dec 7 16:57:28 2007 From: chris.tipper at gmail.com (Christopher G D Tipper) Date: Fri, 7 Dec 2007 21:57:28 +0000 Subject: [Rubyosa-discuss] Word 2004 Message-ID: Hi, I'm scoping out RubyOSA for automating Word 2008 when it is released. I'm testing Word 2004 on an iMac G5. $ruby --version ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0] $gem list rubyosa rubyosa (0.4.0) Word is open and a document loaded. I can't get an application reference to Microsoft Word. With app = OSA.app('Microsoft Word') or app = OSA.app(:path => '/Applications/Microsoft Office 2004/Microsoft Word.app') I get /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:329:in `__scripting_info__': Can't locate the target bundle on the file system (RuntimeError) With app = OSA.app(:bundle_id => 'com.microsoft.Word') I get /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:329: [BUG] Bus Error ruby 1.8.6 (2007-09-24) [powerpc-darwin8.11.0] Abort trap Best wishes, Christopher From justin at carpeaqua.com Sat Dec 15 12:32:41 2007 From: justin at carpeaqua.com (Justin Williams) Date: Sat, 15 Dec 2007 11:32:41 -0600 Subject: [Rubyosa-discuss] Settings IPTC Data in Aperture Message-ID: I've run into an issue with a script I'm trying to write for Aperture. I'm trying to write a script that automatically set the Copyright notice based on the CaptureYear (as well as a few other batch changes). It looks like calling iptc_tags on an Aperture::ImageVersion only returns iptc fields that are populated. Is there a way to grab all the fields, so I can set their values in my script? Thanks for the help. - Justin Williams justin at carpeaqua.com http://carpeaqua.com/ - Check out PocketTweets: twitter for your iPhone - -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20071215/2da6c830/attachment.html From chris.tipper at gmail.com Wed Dec 19 07:52:49 2007 From: chris.tipper at gmail.com (Christopher G D Tipper) Date: Wed, 19 Dec 2007 12:52:49 +0000 Subject: [Rubyosa-discuss] Word 2004 In-Reply-To: References: Message-ID: I've further refined the problem by checking my ruby installation. I am currently running Ruby 1.8.6 patchlevel 5000, rbosa 0.4.0 on Mac OS X Tiger 10.4.11. app = OSA.app('Microsoft Word') produces the following error RuntimeError: Can't locate the target bundle on the file system method __scripting_info__ in rbosa.rb at line 329 method app in rbosa.rb at line 329 at top level in word-para.rb at line 8 and app = OSA.app(:bundle_id => 'com.microsoft.Word') produces the following error /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:329: [BUG] Bus Error ruby 1.8.6 (2007-12-17) [powerpc-darwin8.11.0] for completeness I tried app = OSA.app(:path => '/Applications/Microsoft Office 2004/Microsoft Word.app') which produces identical results to the first idiom. Best wishes, Christopher