From umis at ipnet.kiev.ua Mon Apr 2 04:04:56 2007 From: umis at ipnet.kiev.ua (Iwan Svyatenko) Date: Mon, 2 Apr 2007 11:04:56 +0300 Subject: [Rubyosa-discuss] rdoc-osa error Message-ID: Hello When trying to generate doc I get the following error. $ rdoc-osa --name Mail /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/bin/rdoc-osa:158: undefined method `datadir' for Config:Module (NoMethodError) from /usr/local/bin/rdoc-osa:18:in `load' from /usr/local/bin/rdoc-osa:18 I'm running MacOSX 10.4.8 and ruby 1.8.6 (2007-03-24 patchlevel 5000) [powerpc-darwin8.9.0] What's wrong? Iwan From umis at ipnet.kiev.ua Mon Apr 2 05:05:32 2007 From: umis at ipnet.kiev.ua (Iwan Svyatenko) Date: Mon, 2 Apr 2007 12:05:32 +0300 Subject: [Rubyosa-discuss] rdoc-osa error In-Reply-To: References: Message-ID: > I'm running MacOSX 10.4.8 and ruby 1.8.6 (2007-03-24 patchlevel 5000) > [powerpc-darwin8.9.0] Sorry, correct Mac OS X 10.4.9 Iwan From jeanpierre at gmail.com Mon Apr 2 14:13:29 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Mon, 2 Apr 2007 11:13:29 -0700 Subject: [Rubyosa-discuss] rdoc-osa error In-Reply-To: References: Message-ID: On 4/2/07, Iwan Svyatenko wrote: > > > I'm running MacOSX 10.4.8 and ruby 1.8.6 (2007-03-24 patchlevel 5000) > > [powerpc-darwin8.9.0] > > Sorry, correct Mac OS X 10.4.9 i gave this a try and it is working for me on rubyosa svn trunk - not sure if that really helps but i thought i'd mention it. cheers, jean-pierre -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070402/94730673/attachment.html From jeanpierre at gmail.com Mon Apr 2 16:34:47 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Mon, 2 Apr 2007 13:34:47 -0700 Subject: [Rubyosa-discuss] utf8_strings = true, causes data coercion error Message-ID: hi list - oddly when having rubyosa use utf8 strings some calls generate data coercion errors. commenting out the original assignment or temporarily changing the value resolves the problem - script below. cheers, jean-pierre ################### require 'rbosa' # comment the following line out and the script should execute without issue OSA.utf8_strings = true safari = OSA.app('Safari') if safari.nil? puts "ERROR: unable to locate the application 'Safari'" exit end doc = safari.make(OSA::Safari::Document) doc.url = 'http://redhanded.hobix.com' ################### results in: RuntimeError: application returned error: Data could not be coerced to the requested descriptor type (-1700) from /opt/local/lib/ruby/site_ruby/1.8/rbosa.rb:592:in `__send_event__' from /opt/local/lib/ruby/site_ruby/1.8/rbosa.rb:592:in `url=' from (irb):19 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070402/08598c69/attachment-0001.html From jeanpierre at gmail.com Mon Apr 2 17:38:28 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Mon, 2 Apr 2007 14:38:28 -0700 Subject: [Rubyosa-discuss] utf8_strings = true, causes data coercion error In-Reply-To: References: Message-ID: to add to the utf8_string oddities, i've also found that when true, i cannot send keystrokes via system events. might i need to encode the keystroke text differently? cheers, jean-pierre ################### require 'rbosa' # comment the following line out and this works as expected OSA.utf8_strings = true safari = OSA.app ('Safari') if safari.nil? puts "ERROR: unable to locate the application 'Safari'" exit end safari.activate se = OSA.app('System Events') if !se.ui_elements_enabled? sp.current_pane = sp.panes.detect { |p| p.properties[:id] == ' com.apple.preference.universalaccess ' } puts "ERROR: UI element scripting is not enabled. Check 'Enable access for assistive devices'" exit end # this does nothing if utf8_strings is true se.keystroke('n', :using => OSA::SystemEvents::EMDS::COMMAND_DOWN) On 4/2/07, jeanpierre at gmail.com wrote: > > > hi list - > > oddly when having rubyosa use utf8 strings some calls generate data > coercion errors. commenting out the original assignment or temporarily > changing the value resolves the problem - script below. > > cheers, > jean-pierre > > > > ################### > > require 'rbosa' > > # comment the following line out and the script should execute without > issue > OSA.utf8_strings = true > > safari = OSA.app ('Safari') > if safari.nil? > puts "ERROR: unable to locate the application 'Safari'" > exit > end > > doc = safari.make(OSA::Safari::Document) > doc.url = ' http://redhanded.hobix.com' > > ################### > > results in: > > RuntimeError: application returned error: Data could not be coerced to the > requested descriptor type (-1700) > from /opt/local/lib/ruby/site_ruby/1.8/rbosa.rb:592:in > `__send_event__' > from /opt/local/lib/ruby/site_ruby/1.8/rbosa.rb:592:in `url=' > from (irb):19 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070402/abc4ec80/attachment.html From umis at ipnet.kiev.ua Tue Apr 3 03:04:04 2007 From: umis at ipnet.kiev.ua (Iwan Svyatenko) Date: Tue, 3 Apr 2007 10:04:04 +0300 Subject: [Rubyosa-discuss] rdoc-osa error In-Reply-To: References: Message-ID: <9C371B9F-9DE0-4F91-839C-56A4DB6F0BBC@ipnet.kiev.ua> After installed from svn i've still got error $ rdoc-osa --name Mail /usr/local/bin/rdoc-osa:169: undefined method `datadir' for Config:Module (NoMethodError) Method 'datadir' exist in rbconfig.rb After I commented 3 line in rdoc-osa (see below) this work fine: rdoc-osa --name 'Adobe Photoshop CS' --op ~/doc/rdoc/PhotoshopRuby -- template ./allison/allison.rb <--------------------><--------------------><-------------------- ><--------------------><--------------------> /usr/local/lib/ruby/1.8/powerpc-darwin8.9.0/rbconfig.rb <---------cut-----------> # This file was created by mkconfig.rb when ruby was built. Any # changes made to this file will be lost the next time ruby is built. module Config RUBY_VERSION == "1.8.6" or raise "ruby lib version (1.8.6) doesn't match executable version (#{RUBY_VERSION})" TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/powerpc- darwin8.9.0") DESTDIR = '' unless defined? DESTDIR CONFIG = {} CONFIG["DESTDIR"] = DESTDIR CONFIG["INSTALL"] = "/usr/bin/install -c" CONFIG["prefix"] = (TOPDIR || DESTDIR + "/usr/local") CONFIG["EXEEXT"] = "" CONFIG["ruby_install_name"] = "ruby" CONFIG["RUBY_INSTALL_NAME"] = "ruby" CONFIG["RUBY_SO_NAME"] = "ruby" CONFIG["SHELL"] = "/bin/sh" CONFIG["PATH_SEPARATOR"] = ":" CONFIG["PACKAGE_NAME"] = "" CONFIG["PACKAGE_TARNAME"] = "" CONFIG["PACKAGE_VERSION"] = "" CONFIG["PACKAGE_STRING"] = "" CONFIG["PACKAGE_BUGREPORT"] = "" CONFIG["exec_prefix"] = "$(prefix)" CONFIG["bindir"] = "$(exec_prefix)/bin" CONFIG["sbindir"] = "$(exec_prefix)/sbin" CONFIG["libexecdir"] = "$(exec_prefix)/libexec" CONFIG["datadir"] = "$(prefix)/share" <---------cut-----------> /usr/local/bin/rdoc-osa <---------cut-----------> rdoc_flags = '' #template = File.join(Config.datadir('rubyosa'), 'rdoc_html.rb') #if File.exists?(template) # rdoc_flags << " --template '#{template}' " #end rdoc_flags << " --title '#{app_name} RubyOSA API' " rdoc_flags << ' --main OSA ' rdoc_flags << ARGV[2..-1].join(' ') <---------cut-----------> From lsansonetti at apple.com Tue Apr 3 06:52:24 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Tue, 3 Apr 2007 12:52:24 +0200 Subject: [Rubyosa-discuss] rdoc-osa error In-Reply-To: <9C371B9F-9DE0-4F91-839C-56A4DB6F0BBC@ipnet.kiev.ua> References: <9C371B9F-9DE0-4F91-839C-56A4DB6F0BBC@ipnet.kiev.ua> Message-ID: <7397416D-E7AF-47FA-B7AD-0CF73F2B1146@apple.com> Hi Iwan, Thanks for the report. This is a weird issue, on my environment (also 1.8.6) Config.datadir() exists. Is the following patch working for you? Index: bin/rdoc-osa =================================================================== --- bin/rdoc-osa (revision 196) +++ bin/rdoc-osa (working copy) @@ -166,7 +166,7 @@ EOS rdoc_flags = '' -template = File.join(Config.datadir('rubyosa'), 'rdoc_html.rb') +template = File.join(Config::CONFIG['datadir'], 'rubyosa', 'rdoc_html.rb') if File.exists?(template) rdoc_flags << " --template '#{template}' " end Regards, Laurent On Apr 3, 2007, at 9:04 AM, Iwan Svyatenko wrote: > After installed from svn i've still got error > > $ rdoc-osa --name Mail > /usr/local/bin/rdoc-osa:169: undefined method `datadir' for > Config:Module (NoMethodError) > > Method 'datadir' exist in rbconfig.rb > After I commented 3 line in rdoc-osa (see below) this work fine: > > rdoc-osa --name 'Adobe Photoshop CS' --op ~/doc/rdoc/PhotoshopRuby -- > template ./allison/allison.rb > > <--------------------><--------------------><-------------------- >> <--------------------><--------------------> > > /usr/local/lib/ruby/1.8/powerpc-darwin8.9.0/rbconfig.rb > <---------cut-----------> > # This file was created by mkconfig.rb when ruby was built. Any > # changes made to this file will be lost the next time ruby is built. > > module Config > RUBY_VERSION == "1.8.6" or > raise "ruby lib version (1.8.6) doesn't match executable version > (#{RUBY_VERSION})" > > TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/powerpc- > darwin8.9.0") > DESTDIR = '' unless defined? DESTDIR > CONFIG = {} > CONFIG["DESTDIR"] = DESTDIR > CONFIG["INSTALL"] = "/usr/bin/install -c" > CONFIG["prefix"] = (TOPDIR || DESTDIR + "/usr/local") > CONFIG["EXEEXT"] = "" > CONFIG["ruby_install_name"] = "ruby" > CONFIG["RUBY_INSTALL_NAME"] = "ruby" > CONFIG["RUBY_SO_NAME"] = "ruby" > CONFIG["SHELL"] = "/bin/sh" > CONFIG["PATH_SEPARATOR"] = ":" > CONFIG["PACKAGE_NAME"] = "" > CONFIG["PACKAGE_TARNAME"] = "" > CONFIG["PACKAGE_VERSION"] = "" > CONFIG["PACKAGE_STRING"] = "" > CONFIG["PACKAGE_BUGREPORT"] = "" > CONFIG["exec_prefix"] = "$(prefix)" > CONFIG["bindir"] = "$(exec_prefix)/bin" > CONFIG["sbindir"] = "$(exec_prefix)/sbin" > CONFIG["libexecdir"] = "$(exec_prefix)/libexec" > CONFIG["datadir"] = "$(prefix)/share" > <---------cut-----------> > > /usr/local/bin/rdoc-osa > <---------cut-----------> > rdoc_flags = '' > #template = File.join(Config.datadir('rubyosa'), 'rdoc_html.rb') > #if File.exists?(template) > # rdoc_flags << " --template '#{template}' " > #end > rdoc_flags << " --title '#{app_name} RubyOSA API' " > rdoc_flags << ' --main OSA ' > rdoc_flags << ARGV[2..-1].join(' ') > <---------cut-----------> > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From umis at ipnet.kiev.ua Tue Apr 3 07:41:21 2007 From: umis at ipnet.kiev.ua (Iwan Svyatenko) Date: Tue, 3 Apr 2007 14:41:21 +0300 Subject: [Rubyosa-discuss] rdoc-osa error In-Reply-To: <7397416D-E7AF-47FA-B7AD-0CF73F2B1146@apple.com> References: <9C371B9F-9DE0-4F91-839C-56A4DB6F0BBC@ipnet.kiev.ua> <7397416D-E7AF-47FA-B7AD-0CF73F2B1146@apple.com> Message-ID: Hi! Thank you, it's working. Iwan > Is the following patch working for you? > > Index: bin/rdoc-osa > =================================================================== > --- bin/rdoc-osa (revision 196) > +++ bin/rdoc-osa (working copy) > @@ -166,7 +166,7 @@ > EOS > > rdoc_flags = '' > -template = File.join(Config.datadir('rubyosa'), 'rdoc_html.rb') > +template = File.join(Config::CONFIG['datadir'], 'rubyosa', > 'rdoc_html.rb') > if File.exists?(template) > rdoc_flags << " --template '#{template}' " > end > > Regards, > Laurent From wz0403 at gmail.com Thu Apr 5 02:28:34 2007 From: wz0403 at gmail.com (=?ISO-2022-JP?B?GyRCMEBERRsoQiAbJEJBTxsoQg==?=) Date: Thu, 5 Apr 2007 15:28:34 +0900 Subject: [Rubyosa-discuss] Bus Error when Microsoft Office applications Message-ID: <0A7622FE-E8C9-451F-92E2-F9CC6C05BFB3@gmail.com> It doesn't work when I script calling 'Microsoft Office 2004' applications with rubyosa by name, path or signature. irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'rbosa' => true irb(main):003:0> app = OSA.app(:name => "Microsoft PowerPoint") RuntimeError: Can't locate the target bundle on the file system from /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/ rbosa.rb:304:in `__scripting_info__' from /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/ rbosa.rb:304:in `app' from (irb):3 irb(main):004:0> app = OSA.app(:signature => "PPT3") /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/rbosa.rb:304: [BUG] Bus Error ruby 1.8.6 (2007-03-13) [powerpc-darwin8.9.0] irb(main):003:0> app = OSA.app(:path => "/Applications/Microsoft\ Office\ 2004/Microsoft\ PowerPoint") /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/rbosa.rb:304: [BUG] Bus Error ruby 1.8.6 (2007-03-13) [powerpc-darwin8.9.0] Awazu From pjones at pmade.com Mon Apr 9 14:17:15 2007 From: pjones at pmade.com (Peter Jones) Date: Mon, 9 Apr 2007 18:17:15 +0000 Subject: [Rubyosa-discuss] Here is another real world example Message-ID: <20070409181715.GA68012@slim.pmade.com> I've recently decided to switch back to mutt after using Apple Mail for the last several years. As such, I've been working on a few ruby scripts to integrate Mac OS X with mutt. My first set of scripts uses RubyOSA and Ferret to index the OS X Address Book so that I can use it from mutt. The index creation script runs on my Mac: http://pmade.com/svn/oss/mailtools/trunk/bin/abook_index.rb And the searching script runs on the server I have mutt installed on: http://pmade.com/svn/oss/mailtools/trunk/bin/abook_search.rb I hope that this is useful to someone. -- Peter Jones pmade inc. (http://pmade.com) From laurent.sansonetti at gmail.com Mon Apr 9 17:10:17 2007 From: laurent.sansonetti at gmail.com (Laurent Sansonetti) Date: Mon, 9 Apr 2007 23:10:17 +0200 Subject: [Rubyosa-discuss] Bus Error when Microsoft Office applications In-Reply-To: <0A7622FE-E8C9-451F-92E2-F9CC6C05BFB3@gmail.com> References: <0A7622FE-E8C9-451F-92E2-F9CC6C05BFB3@gmail.com> Message-ID: <1be7247c0704091410j2018b6e6gc61bcc477e06af21@mail.gmail.com> Hi, Thanks for the report. At a glance it seems that Microsoft Office 2004 applications are not provided under .app bundles, but standalone executable (at least in the version I could install). This could explain why RubyOSA has problems to connect to them. I will investigate but perhaps not for the upcoming release. Laurent On 4/5/07, ?? ? wrote: > It doesn't work when I script calling 'Microsoft Office 2004' > applications with rubyosa by name, path or signature. > > irb(main):001:0> require 'rubygems' > => true > > irb(main):002:0> require 'rbosa' > => true > > irb(main):003:0> app = OSA.app(:name => "Microsoft PowerPoint") > RuntimeError: Can't locate the target bundle on the file system > from /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/ > rbosa.rb:304:in `__scripting_info__' > from /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/ > rbosa.rb:304:in `app' > from (irb):3 > > irb(main):004:0> app = OSA.app(:signature => "PPT3") > /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/rbosa.rb:304: > [BUG] Bus Error > ruby 1.8.6 (2007-03-13) [powerpc-darwin8.9.0] > > irb(main):003:0> app = OSA.app(:path => "/Applications/Microsoft\ > Office\ 2004/Microsoft\ PowerPoint") > /usr/local/lib/ruby/gems/1.8/gems/rubyosa-0.3.0.1/lib/rbosa.rb:304: > [BUG] Bus Error > ruby 1.8.6 (2007-03-13) [powerpc-darwin8.9.0] > > Awazu > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss > From laurent.sansonetti at gmail.com Wed Apr 11 17:34:27 2007 From: laurent.sansonetti at gmail.com (Laurent Sansonetti) Date: Wed, 11 Apr 2007 23:34:27 +0200 Subject: [Rubyosa-discuss] [ANN] RubyOSA 0.4.0 Message-ID: <1be7247c0704111434y4de4bdc1pb690a055deddafdd@mail.gmail.com> Hi rubyists, I am honored to announce the immediate availability of RubyOSA 0.4.0. RubyOSA is a bridge that connects Ruby to the Apple Event Manager infrastructure. It allows Ruby programs to automate Mac OS X applications in the same way as AppleScript. More information on the project home page: http://rubyosa.rubyforge.org/ The project home page has been completely revamped and the guide has been improved. This new release fixes some important issues, enhances the existing features set and provides some new samples. The complete release notes are following. Enjoy, Laurent <<< Features: - Added the possibility to retrieve from an object specifier list object the values of a given attribute, via the 'every' method ; - Examples: iTunes/tag_genre_lastfm.rb (new revision that queries Last.fm only once per artist), iTunes/name_that_tune.rb, Photoshop/new_doc.rb, Photoshop/new_doc_with_text.rb ; - The rdoc-osa tool now supports scripting additions (via the '--addition' argument) ; - Added conversion support for color types ; - Allow multiple enum values to be passed into the same argument (packing them in an array) ; - Merge an 'activate' method into application objects. Bugfixes: - Fixed the rdoc-osa tool for applications that do not have a name command ; - Fixed 'msng' type conversions ; - Do not fail if a description attribute has an empty value ; - Do not fail if a class inherits from a class that hasn't been defined yet ; - When converting an Hash object to OSA, property convert Array values ; - Convert type-less Float objects to OSA ; - Added the :size attribute as a shortcut to :point_size ; - Fixed the rdoc-osa tool to work when RubyGems isn't available in the machine ; - Make sure to include a 'subj' attribute to apple events without direct parameters. >>> From rberger at ibd.com Sun Apr 22 02:16:12 2007 From: rberger at ibd.com (Robert J. Berger) Date: Sat, 21 Apr 2007 23:16:12 -0700 Subject: [Rubyosa-discuss] Adding a person to a group in Address Book Message-ID: <25609D3B-247A-4B87-B521-19CD283C7E73@ibd.com> I am having a very difficult time figuring out how to add people to a group using ruby osa and Address Book.app What I'm trying to do is: I have a bit of markup in the notes of each person in the address book that specifies which group I want to add the person to. Like: So I'm successfully parsing the notes, extracting the strings for the group names and even creating the new groups when necessary. But I just can't figure out how to add the person to the group! Here's the code and that works up to the point of trying to add the person to the group: #!/usr/bin/env ruby # # Created by Robert J. Berger on 2007-04-20. require "rubygems" require "rbosa" ab = OSA.app('Address Book') # Extend the Application class with a method to find a group by name class OSA::AddressBook::Application def find_group_by_name(name) self.groups.detect {|g| g.name == name} end end # Foreach person in the address book ab.people.each do |person| # get the note text for the current person note = person.note # Skip this person if there is no note next if note.nil? # Find all instances of strings surrounded by < > # And save them as a string of arrays # These strings are the names of the groups that this person should be # assigned to group_names = note.scan(/<(.*?)>/).map {|i| i.first} # For each string in the array group_names.each do |group_name| # Find a group by that name if (working_group = ab.find_group_by_name(group_name)).nil? # If no group with that name was not found, then create the group puts "Creating group #{group_name}" working_group = ab.make(OSA::AddressBook::Group, nil, nil, :name => group_name) end # Here's what I want to do but this doesn't work # I want to add the current person to the group # I can't figure out how to update the people array of the Applications groups puts "Adding #{person.name} to group #{working_group.name}" working_group.people << person # I've tried other ways but this is the way that "should" work but of course it # doesn't since the expresssion working_group.people is and ObjectSpecifierList and # not the object itself. And if I use working_group.people.get, that still won't # work, nor set, or add.... end end ab.save I'm sure there is a way to do it, but I can't figure it out! Thanks Rob ?????????????????????????????? Robert J. Berger - Internet Bandwidth Development, LLC. Voice: 408-882-4755 eFax: +1-408-490-2868 http://www.ibd.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070421/a53c219f/attachment.html From bryan at osesm.com Mon Apr 30 08:38:31 2007 From: bryan at osesm.com (Bryan Liles) Date: Mon, 30 Apr 2007 08:38:31 -0400 Subject: [Rubyosa-discuss] creating todos in iCal Message-ID: # I have some code similar to the following: app = OSA.app('iCal') # make a new calendar cal = app.make(OSA::ICal::Calendar) cal.name = "newcal" # my question is, how do you make a new Todo in a calendar? todo = app.make(OSA::ICal::Todo) # error todo = app.make(OSA::ICal::Todo,cal) # seems to work, but the class is OSA::Element. # What am I doing wrong? --- As a second question, what kind of object can I pass to the :with_data option of the OSA::ICal::Application#make method?