From laurent.sansonetti at gmail.com Fri Mar 2 13:30:01 2007 From: laurent.sansonetti at gmail.com (Laurent Sansonetti) Date: Fri, 2 Mar 2007 19:30:01 +0100 Subject: [Rubyosa-discuss] [ANN] RubyOSA 0.3.0 Message-ID: <1be7247c0703021030v2f06fa6bu9fbdfe8b5c0be1b4@mail.gmail.com> Hi rubyists, I am honored to announce the immediate release of RubyOSA 0.3.0. RubyOSA is a bridge that connects Ruby to the Apple Event Manager infrastructure. In big words, it allows you to do in Ruby what you could do in AppleScript. More information on the project home page (including a more deeply project description, samples etc...): http://rubyosa.rubyforge.org/ Please also note that a tutorial covering all the RubyOSA features is now available: http://rubyosa.rubyforge.org/tutorial.html This new version brings some new interesting features such as the possibility to control applications running on remote machines, use scripting additions, and pass optional parameters to commands using a Hash key/value pair syntax. It also fixes a bunch of important bugs. Following are the complete release notes. Enjoy! Laurent ============= RubyOSA 0.3.0 ============= Features: - Can control applications running on remote machines ; - Now possible to pass optional arguments using key/value Hash pairs (the old way is still possible) ; - added support for merging scripting additions definitions to the current application ; - Better unified API ; - Added new samples: AddressBook/inspect, iTunes/tag_genre_lastfm, Mail/get_selected_mail ; - Translating property codes to human-readable symbols ; - More human-readable errors ; - Added support for before/after location reference types ; - Faster (no more costly evaluation calls). Bugfixes: - Fixed handling of application-level errors ; - Unescape the converted 'alis' paths ; - Now building 64-bit ; - Make sure '$' and '=' are escaped when generating Ruby symbols ; - Added a functional test suite ; - Fixed the OSA -> Ruby 'TIFF' conversion ; - Fixed the Ruby -> OSA 'list_of_*' conversion ; - Make sure we send events with the user-can-interact flag set on ; - Better RDoc generation (removed the Files frame, references to the generated dummy Ruby file and source code, changed the default HTML title) ; - Better inspect methods for OSA::Element and OSA::ObjectSpecifierList ; - Same conversion behavior for 'type' than 'type class' ; - Smarter #get method, if the resolved object doesn't inherit from the desired class, and if it has a property method with a class key/value, return a new descriptor of the desired class ; - Honors the 'id' attribute of the sdef format ; - Be smarter when converting types from Ruby to OSA, making sure primitive types are always converted ; - Fixed a memory leak ; - Added a new global setting to control either a return value should be expected or not from the following Apple events. Variable is OSA.wait_reply, default value is nil which means "automatic behavior". From eric at 5stops.com Fri Mar 2 16:19:04 2007 From: eric at 5stops.com (Eric Lindvall) Date: Fri, 2 Mar 2007 13:19:04 -0800 Subject: [Rubyosa-discuss] [ANN] RubyOSA 0.3.0 In-Reply-To: <1be7247c0703021030v2f06fa6bu9fbdfe8b5c0be1b4@mail.gmail.com> References: <1be7247c0703021030v2f06fa6bu9fbdfe8b5c0be1b4@mail.gmail.com> Message-ID: <4e1e8c4f0703021319j6e7bf548xe7317e1480b84d2d@mail.gmail.com> I just wanted to let you know that the "alis" stuff is working great with my iTunes scripts. Thanks for all the work! e. On 3/2/07, Laurent Sansonetti wrote: > Hi rubyists, > > I am honored to announce the immediate release of RubyOSA 0.3.0. > > RubyOSA is a bridge that connects Ruby to the Apple Event Manager > infrastructure. In big words, it allows you to do in Ruby what you > could do in AppleScript. > > More information on the project home page (including a more deeply > project description, samples etc...): > > http://rubyosa.rubyforge.org/ > > Please also note that a tutorial covering all the RubyOSA features is > now available: > > http://rubyosa.rubyforge.org/tutorial.html > > This new version brings some new interesting features such as the > possibility to control applications running on remote machines, use > scripting additions, and pass optional parameters to commands using a > Hash key/value pair syntax. > > It also fixes a bunch of important bugs. > > Following are the complete release notes. Enjoy! > > Laurent > > ============= > RubyOSA 0.3.0 > ============= > > Features: > - Can control applications running on remote machines ; > - Now possible to pass optional arguments using key/value Hash pairs (the old > way is still possible) ; > - added support for merging scripting additions definitions to the current > application ; > - Better unified API ; > - Added new samples: AddressBook/inspect, iTunes/tag_genre_lastfm, > Mail/get_selected_mail ; > - Translating property codes to human-readable symbols ; > - More human-readable errors ; > - Added support for before/after location reference types ; > - Faster (no more costly evaluation calls). > > Bugfixes: > - Fixed handling of application-level errors ; > - Unescape the converted 'alis' paths ; > - Now building 64-bit ; > - Make sure '$' and '=' are escaped when generating Ruby symbols ; > - Added a functional test suite ; > - Fixed the OSA -> Ruby 'TIFF' conversion ; > - Fixed the Ruby -> OSA 'list_of_*' conversion ; > - Make sure we send events with the user-can-interact flag set on ; > - Better RDoc generation (removed the Files frame, references to the generated > dummy Ruby file and source code, changed the default HTML title) ; > - Better inspect methods for OSA::Element and OSA::ObjectSpecifierList ; > - Same conversion behavior for 'type' than 'type class' ; > - Smarter #get method, if the resolved object doesn't inherit from the desired > class, and if it has a property method with a class key/value, return a new > descriptor of the desired class ; > - Honors the 'id' attribute of the sdef format ; > - Be smarter when converting types from Ruby to OSA, making sure primitive > types are always converted ; > - Fixed a memory leak ; > - Added a new global setting to control either a return value should be > expected or not from the following Apple events. Variable is OSA.wait_reply, > default value is nil which means "automatic behavior". > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss > > From lsansonetti at apple.com Fri Mar 2 17:28:06 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Fri, 2 Mar 2007 23:28:06 +0100 Subject: [Rubyosa-discuss] [ANN] RubyOSA 0.3.0 In-Reply-To: <4e1e8c4f0703021319j6e7bf548xe7317e1480b84d2d@mail.gmail.com> References: <1be7247c0703021030v2f06fa6bu9fbdfe8b5c0be1b4@mail.gmail.com> <4e1e8c4f0703021319j6e7bf548xe7317e1480b84d2d@mail.gmail.com> Message-ID: Good to hear that! I think that 0.3.0 will be the last "big" release for a while. But I'm sure some bugs will be discovered though. If you find something wrong again, please tell me :-) Laurent On Mar 2, 2007, at 10:19 PM, Eric Lindvall wrote: > I just wanted to let you know that the "alis" stuff is working great > with my iTunes scripts. > > Thanks for all the work! > > e. > > > On 3/2/07, Laurent Sansonetti wrote: >> Hi rubyists, >> >> I am honored to announce the immediate release of RubyOSA 0.3.0. >> >> RubyOSA is a bridge that connects Ruby to the Apple Event Manager >> infrastructure. In big words, it allows you to do in Ruby what you >> could do in AppleScript. >> >> More information on the project home page (including a more deeply >> project description, samples etc...): >> >> http://rubyosa.rubyforge.org/ >> >> Please also note that a tutorial covering all the RubyOSA features is >> now available: >> >> http://rubyosa.rubyforge.org/tutorial.html >> >> This new version brings some new interesting features such as the >> possibility to control applications running on remote machines, use >> scripting additions, and pass optional parameters to commands using a >> Hash key/value pair syntax. >> >> It also fixes a bunch of important bugs. >> >> Following are the complete release notes. Enjoy! >> >> Laurent >> >> ============= >> RubyOSA 0.3.0 >> ============= >> >> Features: >> - Can control applications running on remote machines ; >> - Now possible to pass optional arguments using key/value Hash >> pairs (the old >> way is still possible) ; >> - added support for merging scripting additions definitions to the >> current >> application ; >> - Better unified API ; >> - Added new samples: AddressBook/inspect, iTunes/tag_genre_lastfm, >> Mail/get_selected_mail ; >> - Translating property codes to human-readable symbols ; >> - More human-readable errors ; >> - Added support for before/after location reference types ; >> - Faster (no more costly evaluation calls). >> >> Bugfixes: >> - Fixed handling of application-level errors ; >> - Unescape the converted 'alis' paths ; >> - Now building 64-bit ; >> - Make sure '$' and '=' are escaped when generating Ruby symbols ; >> - Added a functional test suite ; >> - Fixed the OSA -> Ruby 'TIFF' conversion ; >> - Fixed the Ruby -> OSA 'list_of_*' conversion ; >> - Make sure we send events with the user-can-interact flag set on ; >> - Better RDoc generation (removed the Files frame, references to >> the generated >> dummy Ruby file and source code, changed the default HTML title) ; >> - Better inspect methods for OSA::Element and >> OSA::ObjectSpecifierList ; >> - Same conversion behavior for 'type' than 'type class' ; >> - Smarter #get method, if the resolved object doesn't inherit from >> the desired >> class, and if it has a property method with a class key/value, >> return a new >> descriptor of the desired class ; >> - Honors the 'id' attribute of the sdef format ; >> - Be smarter when converting types from Ruby to OSA, making sure >> primitive >> types are always converted ; >> - Fixed a memory leak ; >> - Added a new global setting to control either a return value >> should be >> expected or not from the following Apple events. Variable is >> OSA.wait_reply, >> default value is nil which means "automatic behavior". >> _______________________________________________ >> Rubyosa-discuss mailing list >> Rubyosa-discuss at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rubyosa-discuss >> >> > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From lpruszynski at gmail.com Sat Mar 3 01:13:59 2007 From: lpruszynski at gmail.com (Les Pruszynski) Date: Sat, 3 Mar 2007 06:13:59 +0000 Subject: [Rubyosa-discuss] Merge problems Message-ID: <41B18A75-B186-4371-98FA-6EC55553E6DE@gmail.com> Hello, Have just installed rubyosa (0.3.0.1) via ruby gem. But when trying to merge an application with StandardAdditions I get the following error. irb(main):004:0> app = OSA.app('iTunes') => # irb(main):005:0> app.merge('StandardAdditions') NoMethodError: undefined method `merge' for # from (irb):5 I'm running MacOSX 10.4.8. Is anybody else having the same problem? Les From lrz at chopine.be Sat Mar 3 06:09:00 2007 From: lrz at chopine.be (Laurent Sansonetti) Date: Sat, 3 Mar 2007 12:09:00 +0100 Subject: [Rubyosa-discuss] Merge problems In-Reply-To: <41B18A75-B186-4371-98FA-6EC55553E6DE@gmail.com> References: <41B18A75-B186-4371-98FA-6EC55553E6DE@gmail.com> Message-ID: <6E20C07C-BB84-4BD4-97DB-B1107D46EA89@chopine.be> Hi Les, Are you sure you are using the 0.3.0 version of RubyOSA? Maybe you have both 0.2.0 and 0.3.0 installed in your machine and RubyGems is loading 0.2.0 by default. If you do `gem list', do you only see RubyOSA 0.3.0? Laurent On Mar 3, 2007, at 7:13 AM, Les Pruszynski wrote: > Hello, > Have just installed rubyosa (0.3.0.1) via ruby gem. > > But when trying to merge an application with StandardAdditions I get > the following error. > > irb(main):004:0> app = OSA.app('iTunes') > => # > irb(main):005:0> app.merge('StandardAdditions') > NoMethodError: undefined method `merge' for > # > from (irb):5 > > I'm running MacOSX 10.4.8. > > Is anybody else having the same problem? > Les > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From lists at kalama.no-ip.org Mon Mar 5 19:21:55 2007 From: lists at kalama.no-ip.org (lists) Date: Mon, 5 Mar 2007 18:21:55 -0600 Subject: [Rubyosa-discuss] (no subject) Message-ID: Hi, I'm trying to figure out how to use the methods that I get when I do merge('StandardAdditions') (which is really cool; thank you), but haven't been able to determine how to generate rdocs for this. For example: app = OSA.app('Finder') app.merge('StandardAdditions') Now I can do 'app.choose_from_list(list)' or 'app.display_dialog', but don't know how to for example, allow multiple selections for choose_from_list or how to create buttons other than Cancel and OK for display_dialog. Any ideas on how to generate the rdocs for the StandardAdditons methods? Thanks. From lsansonetti at apple.com Wed Mar 7 10:11:18 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Wed, 7 Mar 2007 16:11:18 +0100 Subject: [Rubyosa-discuss] (no subject) In-Reply-To: References: Message-ID: <869EF639-FB1E-47FA-94CA-19C3C955E722@apple.com> Hi, Actually I completely forgot about this :-) Right now it isn't possible to generate RDocs for scripting additions unless you hack a bit rdoc-osa. I will work on this and release a new version soon. Thanks for the feedback, Laurent On Mar 6, 2007, at 1:21 AM, lists wrote: > Hi, > I'm trying to figure out how to use the methods that I get when I do > merge('StandardAdditions') (which is really cool; thank you), but > haven't been able to determine how to generate rdocs for this. For > example: > > app = OSA.app('Finder') > app.merge('StandardAdditions') > > Now I can do 'app.choose_from_list(list)' or 'app.display_dialog', > but don't know how to for example, allow multiple selections for > choose_from_list or how to create buttons other than Cancel and OK > for display_dialog. Any ideas on how to generate the rdocs for the > StandardAdditons methods? Thanks. > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From lists at kalama.no-ip.org Wed Mar 7 18:50:08 2007 From: lists at kalama.no-ip.org (lists) Date: Wed, 7 Mar 2007 17:50:08 -0600 Subject: [Rubyosa-discuss] (no subject) In-Reply-To: <869EF639-FB1E-47FA-94CA-19C3C955E722@apple.com> References: <869EF639-FB1E-47FA-94CA-19C3C955E722@apple.com> Message-ID: <65167FDB-9C5D-4714-9A07-9F90643ABBB1@kalama.no-ip.org> Thanks, and sorry for no subject! On Mar 7, 2007, at 9:11 AM, Laurent Sansonetti wrote: > Hi, > > Actually I completely forgot about this :-) Right now it isn't > possible to generate RDocs for scripting additions unless you hack a > bit rdoc-osa. I will work on this and release a new version soon. > > Thanks for the feedback, > Laurent > > On Mar 6, 2007, at 1:21 AM, lists wrote: > >> Hi, >> I'm trying to figure out how to use the methods that I get when >> I do >> merge('StandardAdditions') (which is really cool; thank you), but >> haven't been able to determine how to generate rdocs for this. For >> example: >> >> app = OSA.app('Finder') >> app.merge('StandardAdditions') >> >> Now I can do 'app.choose_from_list(list)' or 'app.display_dialog', >> but don't know how to for example, allow multiple selections for >> choose_from_list or how to create buttons other than Cancel and OK >> for display_dialog. Any ideas on how to generate the rdocs for the >> StandardAdditons methods? Thanks. >> _______________________________________________ >> Rubyosa-discuss mailing list >> Rubyosa-discuss at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rubyosa-discuss > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss > From jeanpierre at gmail.com Sat Mar 17 20:02:48 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Sat, 17 Mar 2007 17:02:48 -0700 Subject: [Rubyosa-discuss] System Events and sending keystrokes Message-ID: hi list - i'm trying to use system events to send keystrokes to applications (quite useful when the target application does a poor job with their scripting dictionary), but i can't really figure out how to set the target process for System Events to work on. in applescript it might be something like: tell application "System Events" tell process "Live" -- something end tell end tell short of setting a target process, it appears as though the keystrokes sent from system events are delivered to the active application, but i cannot manage to focus an application. some applications appear to offer a frontmost= method (although even when i message itunes with false it focuses - interesting) but many others do not. i have generated documentation for System Events and poked through ApplicationProcess/Process/UIElement but i can't seem to figure this out, is there something i'm skipping over? i have a rather creative workaround of using rubycocoa and NSWorkspace to 'launch' the already running application which in turn focuses it, but that really isn't ideal require 'osx/cocoa' require 'rbosa' se = OSA.app('System Events') process = se.application_processes.detect { |p| p.name == 'Live' } OSX::NSWorkspace.sharedWorkspace.launchApplication(process.file.get) # => Live is now focused, muck about might there be a better way? incidentally if i require rbosa before rubycocoa, while the script still executes, i get a whole slew of warnings: /Library/BridgeSupport/CoreFoundation.bridgesupport:2: I/O warning : failed to load external entity " file://localhost/System/Library/DTDs/BridgeSupport.dtd" CTYPE signatures SYSTEM " file://localhost/System/Library/DTDs/BridgeSupport.dtd" ^ /Library/BridgeSupport/Foundation.bridgesupport:2: I/O warning : failed to load external entity "file://localhost/System/Library/DTDs/BridgeSupport.dtd " CTYPE signatures SYSTEM " file://localhost/System/Library/DTDs/BridgeSupport.dtd" ^ /Library/BridgeSupport/CoreGraphics.bridgesupport:2: I/O warning : failed to load external entity " file://localhost/System/Library/DTDs/BridgeSupport.dtd" CTYPE signatures SYSTEM " file://localhost/System/Library/DTDs/BridgeSupport.dtd" ^ /Library/BridgeSupport/AppKit.bridgesupport:2: I/O warning : failed to load external entity "file://localhost/System/Library/DTDs/BridgeSupport.dtd " CTYPE signatures SYSTEM " file://localhost/System/Library/DTDs/BridgeSupport.dtd" /S/L/DTDs/BrdigeSupport.dtd of course isn't provided by installing rubycocoa-unstable HEAD. cheers, jean-pierre -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070317/f55d27af/attachment-0001.html From jeanpierre at gmail.com Sat Mar 17 22:24:55 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Sat, 17 Mar 2007 19:24:55 -0700 Subject: [Rubyosa-discuss] System Events and sending keystrokes In-Reply-To: References: Message-ID: On 3/17/07, jeanpierre at gmail.com wrote: > [?] > > require 'osx/cocoa' > require 'rbosa' > > se = OSA.app ('System Events') > process = se.application_processes.detect { |p| p.name == 'Live' } > OSX::NSWorkspace.sharedWorkspace.launchApplication(process.file.get) > # => Live is now focused, muck about to potentially save someone from the hassle of trying to figure out how to handle multiple modifiers, see the weird hash below. also, a sleep after 'launching' the application might be a good idea to insure that it is ready to handle keystrokes. se.keystroke('{', {:using => OSA::SystemEvents::EMDS::SHIFT_DOWN, :using => OSA::SystemEvents::EMDS::COMMAND_DOWN}) cheers, jean-pierre -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070317/b2268ed3/attachment.html From mlists at pmade.com Sun Mar 18 15:00:09 2007 From: mlists at pmade.com (Peter Jones) Date: Sun, 18 Mar 2007 13:00:09 -0600 Subject: [Rubyosa-discuss] System Events and sending keystrokes In-Reply-To: References: Message-ID: On Mar 17, 2007, at 20:24, jeanpierre at gmail.com wrote: > se.keystroke('{', {:using => > OSA::SystemEvents::EMDS::SHIFT_DOWN, :using => > OSA::SystemEvents::EMDS::COMMAND_DOWN}) How does this work, since you're passing in a hash with duplicate keys? -p -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070318/4ff4f04c/attachment.html From brian at codekitchen.net Tue Mar 20 12:34:47 2007 From: brian at codekitchen.net (Brian Palmer) Date: Tue, 20 Mar 2007 10:34:47 -0600 Subject: [Rubyosa-discuss] Problem with iCal.app's calendars collection Message-ID: <0D0F3A21-9042-47BB-BD39-93A3AA3A2E2B@codekitchen.net> I've run through all the RubyOSA sample scripts OK, but I haven't had any luck trying to script iCal using rubyosa 0.3.0.1 from gems. I'm getting errors when trying to do anything with the iCal object's calendars collection. For example: > require 'rubygems' true > require 'rbosa' true > cal = OSA.app 'ical' > clist = cal.calendars # > clist.size NoMethodError: undefined method `to_4cc' for nil:NilClass > clist.to_a ArgumentError: requires 4 length size string/symbol or integer What strikes me immediately is that the desired_class for the calendars ObjectSpecifierList is OSA::Element, instead of something more specific like OSA::Ical::Calendar, which is the sort of behavior I saw in scripting things like iTunes. In fact, I tried this: > OSA::Ical::Calendar OSA::Element So it appears that OSA::Ical::Calendar is just aliasing to OSA::Element, there's no actual class generated for the Calendar type. My gut tells me that's the problem, since OSA::Element::CODE == nil, but digging through the source code for ~10 minutes didn't bring up anything I could use. Has anybody else run into this? -- Brian Palmer -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070320/b9d64b82/attachment.html From lsansonetti at apple.com Tue Mar 20 18:46:06 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Tue, 20 Mar 2007 23:46:06 +0100 Subject: [Rubyosa-discuss] System Events and sending keystrokes In-Reply-To: References: Message-ID: On Mar 18, 2007, at 8:00 PM, Peter Jones wrote: > On Mar 17, 2007, at 20:24, jeanpierre at gmail.com wrote: > >> se.keystroke('{', {:using => >> OSA::SystemEvents::EMDS::SHIFT_DOWN, :using => >> OSA::SystemEvents::EMDS::COMMAND_DOWN}) > > > How does this work, since you're passing in a hash with duplicate > keys? This won't work indeed, and there is even no certitude in the value that RubyOSA will get (it can be either SHIFT_DOWN or COMMAND_DOWN). Jean-Pierre, I don't think that you can even provide several values for the same parameter in an Apple Event. I think that you would have to "orify" both constants into the same argument. But RubyOSA doesn't support this yet, so I will work on this for the next release. Laurent From lsansonetti at apple.com Tue Mar 20 18:48:04 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Tue, 20 Mar 2007 23:48:04 +0100 Subject: [Rubyosa-discuss] Problem with iCal.app's calendars collection In-Reply-To: <0D0F3A21-9042-47BB-BD39-93A3AA3A2E2B@codekitchen.net> References: <0D0F3A21-9042-47BB-BD39-93A3AA3A2E2B@codekitchen.net> Message-ID: Hi Brian, Thanks for spotting this, this is a RubyOSA issue. I will address this problem in a next release. At a glance the problem seems to be because the "calendar" class is defined after the "application" class in the sdef, and the sdef parser isn't smart enough to handle this. Laurent On Mar 20, 2007, at 5:34 PM, Brian Palmer wrote: > I've run through all the RubyOSA sample scripts OK, but I haven't > had any luck trying to script iCal using rubyosa 0.3.0.1 from gems. > I'm getting errors when trying to do anything with the iCal object's > calendars collection. For example: > > > require 'rubygems' > true > > require 'rbosa' > true > > cal = OSA.app 'ical' > > > clist = cal.calendars > # > > clist.size > NoMethodError: undefined method `to_4cc' for nil:NilClass > > clist.to_a > ArgumentError: requires 4 length size string/symbol or integer > > What strikes me immediately is that the desired_class for the > calendars ObjectSpecifierList is OSA::Element, instead of something > more specific like OSA::Ical::Calendar, which is the sort of > behavior I saw in scripting things like iTunes. In fact, I tried this: > > > OSA::Ical::Calendar > OSA::Element > > So it appears that OSA::Ical::Calendar is just aliasing to > OSA::Element, there's no actual class generated for the Calendar > type. My gut tells me that's the problem, since OSA::Element::CODE > == nil, but digging through the source code for ~10 minutes didn't > bring up anything I could use. Has anybody else run into this? > > -- Brian Palmer > > > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From lsansonetti at apple.com Tue Mar 20 20:28:34 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Wed, 21 Mar 2007 01:28:34 +0100 Subject: [Rubyosa-discuss] System Events and sending keystrokes In-Reply-To: References: Message-ID: <160FA57D-8EF6-4DF0-BE73-BBF73FD4650C@apple.com> Hi Jean-Pierre, I added 2 things in SVN that might help you :) First is ApplicationClass#activate. It's a method that will be added in all application classes that you can use to activate the application (e.g. making it receiving events). Second is the possibility to pass multiple enumerations in the same argument, packing them in an array. Example: OSA.app('TextEdit').activate se.keystroke('t', :using => [OSA::SystemEvents::EMDS::SHIFT_DOWN, OSA::SystemEvents::EMDS::COMMAND_DOWN]) (will toggle the format of the first active TextEdit document) Regarding the BridgeSupport warnings, it looks like ruby-libxml changes the default behavior of libxml. This may not be really important anyway as the BridgeSupport DTD will be present soon. I just hope ruby-libxml doesn't configure libxml so that RubyCocoa will validate all bridge support files before parsing them... Laurent On Mar 18, 2007, at 1:02 AM, jeanpierre at gmail.com wrote: > hi list - > > i'm trying to use system events to send keystrokes to applications > (quite useful when the target application does a poor job with their > scripting dictionary), but i can't really figure out how to set the > target process for System Events to work on. > > in applescript it might be something like: > > tell application "System Events" > tell process "Live" > -- something > end tell > end tell > > > short of setting a target process, it appears as though the > keystrokes sent from system events are delivered to the active > application, but i cannot manage to focus an application. some > applications appear to offer a frontmost= method (although even when > i message itunes with false it focuses - interesting) but many > others do not. > > i have generated documentation for System Events and poked through > ApplicationProcess/Process/UIElement but i can't seem to figure this > out, is there something i'm skipping over? i have a rather creative > workaround of using rubycocoa and NSWorkspace to 'launch' the > already running application which in turn focuses it, but that > really isn't ideal > > require 'osx/cocoa' > require 'rbosa' > > se = OSA.app('System Events') > process = se.application_processes.detect { |p| p.name == 'Live' } > OSX::NSWorkspace.sharedWorkspace.launchApplication(process.file.get) > # => Live is now focused, muck about > > might there be a better way? > > > incidentally if i require rbosa before rubycocoa, while the script > still executes, i get a whole slew of warnings: > /Library/BridgeSupport/CoreFoundation.bridgesupport:2: I/O > warning : failed to load external entity "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > CTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > ^ > /Library/BridgeSupport/Foundation.bridgesupport:2: I/O warning : > failed to load external entity "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > CTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > ^ > /Library/BridgeSupport/CoreGraphics.bridgesupport:2: I/O warning : > failed to load external entity "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > CTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > ^ > /Library/BridgeSupport/AppKit.bridgesupport:2: I/O warning : > failed to load external entity "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > CTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd > " > > /S/L/DTDs/BrdigeSupport.dtd of course isn't provided by installing > rubycocoa-unstable HEAD. > > cheers, > jean-pierre > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From jeanpierre at gmail.com Wed Mar 21 15:53:58 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Wed, 21 Mar 2007 12:53:58 -0700 Subject: [Rubyosa-discuss] UI scripting example Message-ID: i've converted one of the UI scripting samples from /Library/Scripts/UI Element Scripts/ and it seems to be working as expected. it is a bit ugly in spots but i'm hoping it might get others started with UI scripting via rubyosa. cheers, jean-pierre ############## require 'rbosa' # /Library/Scripts/UI Element Scripts/Get User Name.applescript SCRIPT = < References: <0D0F3A21-9042-47BB-BD39-93A3AA3A2E2B@codekitchen.net> Message-ID: Sorry for the late response, I just fixed the problem in r195. Thanks for your patience :-) Laurent On Mar 20, 2007, at 11:48 PM, Laurent Sansonetti wrote: > Hi Brian, > > Thanks for spotting this, this is a RubyOSA issue. I will address this > problem in a next release. At a glance the problem seems to be because > the "calendar" class is defined after the "application" class in the > sdef, and the sdef parser isn't smart enough to handle this. > > Laurent > > On Mar 20, 2007, at 5:34 PM, Brian Palmer wrote: > >> I've run through all the RubyOSA sample scripts OK, but I haven't >> had any luck trying to script iCal using rubyosa 0.3.0.1 from gems. >> I'm getting errors when trying to do anything with the iCal object's >> calendars collection. For example: >> >> >>> require 'rubygems' >> true >> >>> require 'rbosa' >> true >> >>> cal = OSA.app 'ical' >> >> >>> clist = cal.calendars >> # >> >>> clist.size >> NoMethodError: undefined method `to_4cc' for nil:NilClass >> >>> clist.to_a >> ArgumentError: requires 4 length size string/symbol or integer >> >> What strikes me immediately is that the desired_class for the >> calendars ObjectSpecifierList is OSA::Element, instead of something >> more specific like OSA::Ical::Calendar, which is the sort of >> behavior I saw in scripting things like iTunes. In fact, I tried >> this: >> >> >>> OSA::Ical::Calendar >> OSA::Element >> >> So it appears that OSA::Ical::Calendar is just aliasing to >> OSA::Element, there's no actual class generated for the Calendar >> type. My gut tells me that's the problem, since OSA::Element::CODE >> == nil, but digging through the source code for ~10 minutes didn't >> bring up anything I could use. Has anybody else run into this? >> >> -- Brian Palmer >> >> >> >> _______________________________________________ >> Rubyosa-discuss mailing list >> Rubyosa-discuss at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rubyosa-discuss > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From lsansonetti at apple.com Sun Mar 25 21:09:56 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Mon, 26 Mar 2007 03:09:56 +0200 Subject: [Rubyosa-discuss] ObjectSpecifierList#every Message-ID: <65EA4DA8-1D88-44EE-ADC4-C9F2A9C55515@apple.com> Hi all, If you're watching the commit logs, last week I added a new feature in RubyOSA that lets you get the value of all attributes of an object specifier list. But I didn't have a good name for it, and Mike and I just came up with something good. So, instead of writing: OSA.app('iCal').calendars.map { |c| c.name } You can now write: OSA.app('iCal').calendars.every(:name) You will get the same result (an Array of String objects), but... #every will be a bit faster, as it will get all attributes at once, in the same Apple Event. Note that this shouldn't really be important for most users and use cases. But you may need this if you are dealing with an application that shares _lots_ of objects and if you're encountering a performance issue. The generated RDocs will soon describe this change. Enjoy, Laurent From dmw_rubyosa at spamex.com Tue Mar 27 11:58:58 2007 From: dmw_rubyosa at spamex.com (dmw_rubyosa at spamex.com) Date: Tue, 27 Mar 2007 10:58:58 -0500 Subject: [Rubyosa-discuss] Scripting OmniGraffle Pro Message-ID: <20070327152224.843BB5240948@rubyforge.org> I'm having some difficulty figuring out how to script OmniGraffle Pro with RubyOSA. Here's the script I'm trying to convert from AppleScript to Ruby: --- BEGIN ogtest.applescript --- tell application "OmniGraffle Professional" activate tell canvas of front window make new shape at end of graphics with properties {origin:{87.0, 68.0}, size:{102.0, 102.0}} end tell end tell --- END ogtest.applescript --- and here's my current attempt at a translation: --- BEGIN ogtest.rb --- require 'rubygems' require 'rbosa' og = OSA.app('OmniGraffle Professional') include OSA::OmniGraffleProfessional window = og.windows[0] canvas = window.canvas graphics = canvas.graphics og.make(:new => Shape, :at => graphics[0], :with_properties => {:origin => [87, 68], :size => [102, 102]} ) --- END ogtest.rb --- (note: I've tried many, many variations of the above call to 'make') and here's the result: --- BEGIN results --- RubyMate r6354 running Ruby r1.8.5 (/opt/local/bin/ruby) >>> ogtest.rb ArgumentError: wrong number of arguments (1 for 2) method __new__ in rbosa.rb at line 120 method from_rbobj in rbosa.rb at line 120 method make in rbosa.rb at line 730 method each in rbosa.rb at line 704 method make in rbosa.rb at line 704 at top level in ogtest.rb at line 10 --- END results --- If it helps, I've posted the generated OmniGraffle Pro documentation at: http://humblehacker.com/rubyosa/OmniGraffleProfessional/doc/ I have one specific question related to all of this. When in AppleScript one tries to "tell canvas to make new shape". How would this translate to rubyosa? My na?ve first guess would be "canvas.make(Shape)", but only the Application class has a make method. I'd appreciate it greatly if anyone could shed some light on this problem. Thanks, David From dmw_rubyosa at spamex.com Tue Mar 27 12:46:43 2007 From: dmw_rubyosa at spamex.com (dmw_rubyosa at spamex.com) Date: Tue, 27 Mar 2007 11:46:43 -0500 Subject: [Rubyosa-discuss] Scripting OmniGraffle Pro Message-ID: <20070327155029.E4A165240948@rubyforge.org> Follow-up: The code I originally sent was not what I had intended. Here's another sample with results. --- BEGIN ogtest.applescript --- require 'rubygems' require 'rbosa' og = OSA.app('OmniGraffle Professional') include OSA::OmniGraffleProfessional window = og.windows[0] canvas = window.canvas graphics = canvas.graphics og.make(Shape, :at => graphics[0], :with_properties => {:origin => [87, 68], :size => [102, 102]}) --- END ogtest.applescript --- --- BEGIN results --- RubyMate r6354 running Ruby r1.8.5 (/opt/local/bin/ruby) >>> ogtest.rb RuntimeError: application returned error: siInitVBLQsErr / dsAddressErr / scCommErr / ENOENT (2), with message: NSContainerSpecifierError method __send_event__ in rbosa.rb at line 742 method make in rbosa.rb at line 742 at top level in ogtest.rb at line 10 --- END results --- From lsansonetti at apple.com Tue Mar 27 19:06:58 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Wed, 28 Mar 2007 01:06:58 +0200 Subject: [Rubyosa-discuss] Scripting OmniGraffle Pro In-Reply-To: <20070327155029.E4A165240948@rubyforge.org> References: <20070327155029.E4A165240948@rubyforge.org> Message-ID: Hi David, I investigated your problem, and noticed 3 issues. 1) when converting an Hash object to OSA, Array values weren't converted 2) typeless Float objects weren't converted to OSA 3) the :size attribute name wasn't recognized (in the API it is :point_size) I fixed all problems in SVN, and now the following seems to work on my environment: $ og = OSA.app('Omnigraffle Professional') $ og.make(OSA::OmnigraffleProfessional::Shape, :at => og.windows[0].canvas.graphics[0], :with_properties => {:origin => [87.0, 68.0], :size => [102.0, 102.0]}) Note that you must pass float objects for the origin and size values, OG won't recognize integers. Otherwise the rest of the code should be the same than the one you lastly provided. Thanks for your report! Laurent On Mar 27, 2007, at 6:46 PM, dmw_rubyosa at spamex.com wrote: > Follow-up: > > The code I originally sent was not what I had intended. Here's > another sample with results. > > --- BEGIN ogtest.applescript --- > require 'rubygems' > require 'rbosa' > > og = OSA.app('OmniGraffle Professional') > include OSA::OmniGraffleProfessional > > window = og.windows[0] > canvas = window.canvas > graphics = canvas.graphics > og.make(Shape, > :at => graphics[0], > :with_properties => {:origin => [87, 68], :size => [102, 102]}) > --- END ogtest.applescript --- > > --- BEGIN results --- > RubyMate r6354 running Ruby r1.8.5 (/opt/local/bin/ruby) >> >>> >>>> ogtest.rb > RuntimeError: application returned error: siInitVBLQsErr / > dsAddressErr / scCommErr / ENOENT (2), with message: > NSContainerSpecifierError > > method __send_event__ in rbosa.rb at line 742 > method make in rbosa.rb at line 742 > at top level in ogtest.rb at line 10 > --- END results --- > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From eoin.brazil at ul.ie Thu Mar 29 09:40:12 2007 From: eoin.brazil at ul.ie (Eoin Brazil) Date: Thu, 29 Mar 2007 14:40:12 +0100 Subject: [Rubyosa-discuss] Listing and adding tracks in iTunes trouble - 0.3.0.1 Message-ID: I have been trying to use the code from James MacAulay ( http://rubyforge.org/pipermail/rubyosa-discuss/2007-January/000090.html) in order to be able to pass a String (filename) to OSA::ITunes::Application#add and I've been getting some errors. Can anyone tell me what I'm doing wrong or what I need to do to correct the errors ? I've include the details and the code that I'm using below. Thanks, Eoin Platfrom: Mac OS X 10.4.8 build 8L127 Ruby: ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0] RubyOSA: Gem version of rubyosa (0.3.0.1, 0.2.0, 0.1.0) with rubygems 0.9.0 ---Command prompt output: ****:~/Desktop/useridsounds/possibleuseridsounds/sids username$ ruby test.rb /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `__new__': Invalid argument of type 'Array' (required: OSA::Element) (ArgumentError) from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `convert_to_osa' from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:119:in `from_rbobj' from (eval):2:in `add' from test.rb:12 ---Test.rb: #!/usr/bin/env ruby # begin require 'rubygems'; rescue LoadError; end require 'rbosa' app = OSA.app('itunes') ps = app.sources[0].playlists.find {|p| p.name == 'Party Shuffle'} track = app.sources[0].library_playlists[0].tracks[25] app.add(track.get.location,ps) From eoin.brazil at ul.ie Thu Mar 29 09:44:10 2007 From: eoin.brazil at ul.ie (Eoin Brazil) Date: Thu, 29 Mar 2007 14:44:10 +0100 Subject: [Rubyosa-discuss] Listing and adding tracks in iTunes trouble - 0.3.0.1 Message-ID: I have been trying to use the code from James MacAulay ( http://rubyforge.org/pipermail/rubyosa-discuss/2007-January/000090.html) in order to be able to pass a String (filename) to OSA::ITunes::Application#add and I've been getting some errors. Can anyone tell me what I'm doing wrong or what I need to do to correct the errors ? I've include the details and the code that I'm using below. Thanks, Eoin Platfrom: Mac OS X 10.4.8 build 8L127 Ruby: ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0] RubyOSA: Gem version of rubyosa (0.3.0.1, 0.2.0, 0.1.0) with rubygems 0.9.0 ---Command prompt output: ****:~/Desktop/useridsounds/possibleuseridsounds/sids username$ ruby test.rb /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `__new__': Invalid argument of type 'Array' (required: OSA::Element) (ArgumentError) from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `convert_to_osa' from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:119:in `from_rbobj' from (eval):2:in `add' from test.rb:12 ---Test.rb: #!/usr/bin/env ruby # begin require 'rubygems'; rescue LoadError; end require 'rbosa' app = OSA.app('itunes') ps = app.sources[0].playlists.find {|p| p.name == 'Party Shuffle'} track = app.sources[0].library_playlists[0].tracks[25] app.add(track.get.location,ps) From ryandhanks at gmail.com Thu Mar 29 12:57:32 2007 From: ryandhanks at gmail.com (Ryan Hanks) Date: Thu, 29 Mar 2007 11:57:32 -0500 Subject: [Rubyosa-discuss] Listing and adding tracks in iTunes trouble - 0.3.0.1 In-Reply-To: References: Message-ID: <284dc3e0703290957l20543dcfh2dddfdd1641610e6@mail.gmail.com> Eoin, I believe that your problem lies in that you are trying to add items to "Party Shuffle". "Party Shuffle", "TV Shows", "Podcasts", et al are a special kind of playlist, more specifically, not a OSA::ITunes::UserPlaylist. Sending :special_kind to a OSA::ITunes::Playlist should tell you more about the playlist, and it's my understanding that only those of type "NONE" are directly modifiable. Is there a particular reason you wanted to add to the "Party Shuffle" list? On 3/29/07, Eoin Brazil wrote: > > I have been trying to use the code from James MacAulay ( > http://rubyforge.org/pipermail/rubyosa-discuss/2007-January/000090.html) > in > order to be able to pass a String (filename) to > OSA::ITunes::Application#add > and I've been getting some errors. Can anyone tell me what I'm doing wrong > or what I need to do to correct the errors ? > > I've include the details and the code that I'm using below. > > Thanks, Eoin > > Platfrom: Mac OS X 10.4.8 build 8L127 > Ruby: ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0] > RubyOSA: Gem version of rubyosa (0.3.0.1, 0.2.0, 0.1.0) with rubygems > 0.9.0 > > ---Command prompt output: > > ****:~/Desktop/useridsounds/possibleuseridsounds/sids username$ ruby > test.rb > /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `__new__': Invalid > argument of type 'Array' (required: OSA::Element) (ArgumentError) > from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in > `convert_to_osa' > from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:119:in > `from_rbobj' > from (eval):2:in `add' > from test.rb:12 > > ---Test.rb: > > #!/usr/bin/env ruby > # > > begin require 'rubygems'; rescue LoadError; end > require 'rbosa' > > app = OSA.app('itunes') > ps = app.sources[0].playlists.find {|p| p.name == 'Party Shuffle'} > track = app.sources[0].library_playlists[0].tracks[25] > app.add(track.get.location,ps) > > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070329/24f3b4eb/attachment-0001.html From lsansonetti at apple.com Thu Mar 29 14:17:46 2007 From: lsansonetti at apple.com (Laurent Sansonetti) Date: Thu, 29 Mar 2007 20:17:46 +0200 Subject: [Rubyosa-discuss] Listing and adding tracks in iTunes trouble - 0.3.0.1 In-Reply-To: References: Message-ID: Hi Eoin, At a glance this looks like an old problem that has been fixed in RubyOSA 0.3.0. Just to know, are you sure you don't have an older version installed on your machine? For example, if you installed 0.3.0 using RubyGems, are you sure there isn't an old version that has been installed manually in the system (e.g. in /usr/lib/ruby/site_ruby)? Ruby would load the version in site_ruby in priority then. Laurent On Mar 29, 2007, at 3:40 PM, Eoin Brazil wrote: > I have been trying to use the code from James MacAulay ( > http://rubyforge.org/pipermail/rubyosa-discuss/2007-January/000090.html) > in > order to be able to pass a String (filename) to > OSA::ITunes::Application#add > and I've been getting some errors. Can anyone tell me what I'm doing > wrong > or what I need to do to correct the errors ? > > I've include the details and the code that I'm using below. > > Thanks, Eoin > > Platfrom: Mac OS X 10.4.8 build 8L127 > Ruby: ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0] > RubyOSA: Gem version of rubyosa (0.3.0.1, 0.2.0, 0.1.0) with > rubygems 0.9.0 > > ---Command prompt output: > > ****:~/Desktop/useridsounds/possibleuseridsounds/sids username$ ruby > test.rb > /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `__new__': Invalid > argument of type 'Array' (required: OSA::Element) (ArgumentError) > from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in > `convert_to_osa' > from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:119:in > `from_rbobj' > from (eval):2:in `add' > from test.rb:12 > > ---Test.rb: > > #!/usr/bin/env ruby > # > > begin require 'rubygems'; rescue LoadError; end > require 'rbosa' > > app = OSA.app('itunes') > ps = app.sources[0].playlists.find {|p| p.name == 'Party Shuffle'} > track = app.sources[0].library_playlists[0].tracks[25] > app.add(track.get.location,ps) > > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss From eoin.brazil at ul.ie Thu Mar 29 20:01:14 2007 From: eoin.brazil at ul.ie (Eoin.Brazil) Date: Fri, 30 Mar 2007 01:01:14 +0100 Subject: [Rubyosa-discuss] Listing and adding tracks in iTunes trouble - 0.3.0.1 References: Message-ID: <614D41215A90D74A8BFA259985A94D6E842B20@StaffExchange2.ul.campus> Hi Laurent and Ryan, It's working now - after a little spring clean of /usr/local/lib/ruby/site_ruby which for some reason had a copy of rbosa.rb in it... To answer Ryan's question - Is there a particular reason you wanted to add to the "Party Shuffle" list? - I was only using James MacAulay example code. The idea I'm looking at is using Ruby and iTunes as a discount method of easily generating playlists in the context of doing some pairwise auditory comparisons experiments that I'm running. Ruby makes it nice and easy to randomly select a couple of sounds and pair them off against each other whilst iTunes can help in determing how many plays each sound is getting as well as playing them!. It's not meant as a serious approach for pairwise comparison as tools such as the Sonic Mapper exist to do that, but rather as a good enough method with a familiar interface for participants. I've put a short paragraph and some screenshots online at http://braz.blogspot.com/2007/03/rubyosa-discuss-list-to-rescue.html . I hadn't realised about the priority issues and the directory loading order. Thanks again, Eoin ________________________________ From: Laurent Sansonetti [mailto:lsansonetti at apple.com] Sent: Thu 3/29/2007 7:17 PM To: Eoin Brazil Cc: rubyosa-discuss at rubyforge.org Subject: Re: [Rubyosa-discuss] Listing and adding tracks in iTunes trouble - 0.3.0.1 Hi Eoin, At a glance this looks like an old problem that has been fixed in RubyOSA 0.3.0. Just to know, are you sure you don't have an older version installed on your machine? For example, if you installed 0.3.0 using RubyGems, are you sure there isn't an old version that has been installed manually in the system (e.g. in /usr/lib/ruby/site_ruby)? Ruby would load the version in site_ruby in priority then. Laurent On Mar 29, 2007, at 3:40 PM, Eoin Brazil wrote: > I have been trying to use the code from James MacAulay ( > http://rubyforge.org/pipermail/rubyosa-discuss/2007-January/000090.html) > in > order to be able to pass a String (filename) to > OSA::ITunes::Application#add > and I've been getting some errors. Can anyone tell me what I'm doing > wrong > or what I need to do to correct the errors ? > > I've include the details and the code that I'm using below. > > Thanks, Eoin > > Platfrom: Mac OS X 10.4.8 build 8L127 > Ruby: ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0] > RubyOSA: Gem version of rubyosa (0.3.0.1, 0.2.0, 0.1.0) with > rubygems 0.9.0 > > ---Command prompt output: > > ****:~/Desktop/useridsounds/possibleuseridsounds/sids username$ ruby > test.rb > /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in `__new__': Invalid > argument of type 'Array' (required: OSA::Element) (ArgumentError) > from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:282:in > `convert_to_osa' > from /usr/local/lib/ruby/site_ruby/1.8/rbosa.rb:119:in > `from_rbobj' > from (eval):2:in `add' > from test.rb:12 > > ---Test.rb: > > #!/usr/bin/env ruby > # > > begin require 'rubygems'; rescue LoadError; end > require 'rbosa' > > app = OSA.app('itunes') > ps = app.sources[0].playlists.find {|p| p.name == 'Party Shuffle'} > track = app.sources[0].library_playlists[0].tracks[25] > app.add(track.get.location,ps) > > > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070330/c5c92495/attachment.html From jeanpierre at gmail.com Fri Mar 30 20:15:30 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Fri, 30 Mar 2007 17:15:30 -0700 Subject: [Rubyosa-discuss] data coercion error with ui scripting Message-ID: hi all - i'm running into a strange problem with UI scripting via rubyosa where i try to send a message an object that claims to respond to but results in a failure to coerce the data into the requested descriptor type. cheers, jean-pierre ### require 'rbosa' se = OSA.app('System Events') finder = se.application_processes.find { |p| p.name == 'Finder' } # dump methods on the window that have '?' in the name puts finder.windows[0].methods.grep(/\?/) # try one out that is defined in OSA::SystemEvents::Window finder.windows[0].visible? ### result: 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:558:in `__send_event__' from /opt/local/lib/ruby/site_ruby/1.8/rbosa.rb:558:in `visible?' from (irb):32 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070330/ee2e7b4a/attachment.html