From jeanpierre at gmail.com Fri Jun 8 11:30:34 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Fri, 8 Jun 2007 08:30:34 -0700 Subject: [Rubyosa-discuss] Adding Custom Tags to an image in Aperture In-Reply-To: References: <579B78D8-8164-451B-9A1F-8EFBDCE49EAE@csiro.au> Message-ID: On 6/4/07, Christopher Preston wrote: > > Hi Jean-pierre, > Yes, I discovered that 'make' is the correct method, but as you say > Aperture doesn't declare it to be available (at least as part of RubyOSA). > As I mentioned, you seem to be able to call on it an image version when > using Applescript - I'm not sure if this is a deficiency in the Aperture AS > Dictionary (I think most likely), or RubyOSA. A quick play with rb-appscript > seems to indicate that make is available as a method, but I *really* can't > figure out the right syntax/object & class names!! > > This applescript/Ruby integration thing seems to be a great way to > complexify an otherwise pretty simple language! > > I was hoping that the OSA::Aperture class could be extended as you say, > but I was also hoping someone would suggest how that can be done, but the > mailing list is not very well patronised, it seems. It actually feels like > you and I are the only people in the world who have attempted to marry > Aperture and RubyOSA. > > Let's hope the Aperture AS dictionary is extended in an upcoming release - > perhaps at WWDC even. > sounds as though perhaps rubyosa's handling of aperture's sdef dictionary isn't what we'd expect it to be. if rb-appscript is exposing it, rubyosa should be as well. it might be worth asking laurent about to see if he knows of why this might be occuring - even the documentation that the rdoc-osa command generates doesn't include the make command which is a bit of a bummer. i think it was my fault as i only replied to you rather than the whole list, so others wouldn't have known to comment on the OSA::Aperture bit. i cc'ed the list back on this response and maybe we'll rope in further comment :0) the goal of this is to selectively add tags to images? and the current problem is that there isn't an OSA::Aperture#make right? cheers, jean-pierre -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubyosa-discuss/attachments/20070608/74ac58d7/attachment.html From tjw at omnigroup.com Thu Jun 14 14:35:52 2007 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu, 14 Jun 2007 11:35:52 -0700 Subject: [Rubyosa-discuss] documentation on building different types of specifiers? Message-ID: <652FAF0A-6374-421A-901F-8A2D3AC95A0C@omnigroup.com> Is there documentation on the various types of specifiers RubyOSA supports? In particular, I need to be able to build 'ID ' specifiers, but obviously 'pnam' are needed to. Right now I can get limp along in some cases with: collection.element_name.find {|x| x.id2 == "my id"} but this is slow and doesn't work for cases where you can look up by ID but there is no underlying indexable element on the collection. -tim From tjw at omnigroup.com Thu Jun 14 21:21:56 2007 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu, 14 Jun 2007 18:21:56 -0700 Subject: [Rubyosa-discuss] Can't set dates correctly? Message-ID: <483AB662-A73F-4660-B1BD-08427220EBCE@omnigroup.com> I'm able to get a date via RubyOSA, but I can't seem to set them. When I try to set them, the output from AEDebugReceives for the core/ setd shows: key 'data' - { -1 } 'null': null descriptor This causes Cocoa Scripting to set my date to Jan 1, 1904. Interestingly, I also can't set them to 'missing value'. Looking at the code, it seems like it should work to use nil to mean 'missing value', but the gem is pretty opaque and so it seems this is getting converted to 'null' instead of 'msng'. -tim From tjw at omnigroup.com Fri Jun 15 13:36:01 2007 From: tjw at omnigroup.com (Timothy J. Wood) Date: Fri, 15 Jun 2007 10:36:01 -0700 Subject: [Rubyosa-discuss] How to create content *within* a container Message-ID: The RubyOSA examples show how to create documents, but I'm not seeing any documentation or examples on how to create new objects within a non-app container. For example, how would one do the following? tell application "Sketch" tell front document make new box with properties {width:100, height:100} at end of graphics end tell end tell -tim From Christopher.Preston at csiro.au Sat Jun 16 06:38:28 2007 From: Christopher.Preston at csiro.au (Christopher.Preston at csiro.au) Date: Sat, 16 Jun 2007 20:38:28 +1000 Subject: [Rubyosa-discuss] How to create content *within* a container References: Message-ID: <73141978E50F334AB7042807A520525E01DBDB70@exvicn1-mel.nexus.csiro.au> I have no idea, but I'm dying to find out too! I have an idea to implement with Aperture but it requires sorting out the correct Ruby 'make' syntax, also. Chris. -----Original Message----- From: rubyosa-discuss-bounces at rubyforge.org on behalf of Timothy J. Wood Sent: Sat 16-Jun-07 3:36 AM To: rubyosa-discuss at rubyforge.org Cc: Subject: [Rubyosa-discuss] How to create content *within* a container The RubyOSA examples show how to create documents, but I'm not seeing any documentation or examples on how to create new objects within a non-app container. For example, how would one do the following? tell application "Sketch" tell front document make new box with properties {width:100, height:100} at end of graphics end tell end tell -tim _______________________________________________ Rubyosa-discuss mailing list Rubyosa-discuss at rubyforge.org http://rubyforge.org/mailman/listinfo/rubyosa-discuss From nshb at inimit.com Tue Jun 19 04:54:23 2007 From: nshb at inimit.com (Nathaniel Brown) Date: Tue, 19 Jun 2007 01:54:23 -0700 Subject: [Rubyosa-discuss] No Firefox? Message-ID: I get the following error.. [carbon:~/bin/dev] nshb% ./firefox.rb /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:643:in `__load_sdef__': No application class defined. (RuntimeError) from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:464:in `__app__' from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:329:in `app' from ./firefox.rb:7 With the following script... ---- #!/usr/bin/env ruby require 'rubygems' require 'rbosa' firefox = OSA.app(:bundle_id => 'org.mozilla.firefox') ---- Any idea how I can assign the application class? I checked out the script editor and couldn't find any reference to Firefox. Does this mean I can't access Firefox within OSA? I have in the interm switched to Safari, but would be nice to know why Firefox wouldn't work. Or even if it's not by default, how I can get it to work if that requires me to write up some code. Nathaniel. Nathaniel. -- Nathaniel Steven Henry Brown Toll Free: 1-877-446-4647 Vancouver: 604-724-6624 From jmacaulay at gmail.com Tue Jun 19 09:19:18 2007 From: jmacaulay at gmail.com (James MacAulay) Date: Tue, 19 Jun 2007 09:19:18 -0400 Subject: [Rubyosa-discuss] No Firefox? In-Reply-To: References: Message-ID: <5016BB05-2E2B-4DB3-AECC-F99261A445AC@gmail.com> The programmers of an application need to specifically build a scriptable interface for an application for it to be used with OSA, and no one has done so with Firefox. I think it might be pretty hard for them to do for Firefox at all, since it's such a bare-bones port from other platforms and doesn't use Cocoa or anything. So yeah, you can use Safari instead. Camino seems to have some kind of scriptable interface, too, though I have no idea how extensive it is. James On 19-Jun-07, at 4:54 AM | Jun 19, Nathaniel Brown wrote: > I get the following error.. > > [carbon:~/bin/dev] nshb% ./firefox.rb > /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:643:in > `__load_sdef__': No application class defined. (RuntimeError) > from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/ > rbosa.rb:464:in > `__app__' > from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/ > rbosa.rb:329:in > `app' > from ./firefox.rb:7 > > With the following script... > > ---- > > #!/usr/bin/env ruby > > require 'rubygems' > require 'rbosa' > > firefox = OSA.app(:bundle_id => 'org.mozilla.firefox') > > ---- > > Any idea how I can assign the application class? I checked out the > script editor and couldn't find any reference to Firefox. Does this > mean I can't access Firefox within OSA? > > I have in the interm switched to Safari, but would be nice to know why > Firefox wouldn't work. Or even if it's not by default, how I can get > it to work if that requires me to write up some code. > > Nathaniel. > > Nathaniel. > > -- > Nathaniel Steven Henry Brown > > Toll Free: 1-877-446-4647 > Vancouver: 604-724-6624 > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss --- James MacAulay jmacaulay at gmail.com http://jmacaulay.net http://flickr.com/photos/jmacaulay http://www.jadedpixel.com From jeanpierre at gmail.com Wed Jun 20 00:44:52 2007 From: jeanpierre at gmail.com (jeanpierre at gmail.com) Date: Tue, 19 Jun 2007 21:44:52 -0700 Subject: [Rubyosa-discuss] No Firefox? In-Reply-To: <5016BB05-2E2B-4DB3-AECC-F99261A445AC@gmail.com> References: <5016BB05-2E2B-4DB3-AECC-F99261A445AC@gmail.com> Message-ID: it is true, firefox's scripting support is pretty poor, just opening it up using Script Editor.app and you'll see how limited it is. that said, one could always use System Events via rubyosa and poke around the application using UI scripting - i posted a while back an example of that. cheers, jean-pierre On 6/19/07, James MacAulay wrote: > > The programmers of an application need to specifically build a > scriptable interface for an application for it to be used with OSA, > and no one has done so with Firefox. I think it might be pretty hard > for them to do for Firefox at all, since it's such a bare-bones port > from other platforms and doesn't use Cocoa or anything. > > So yeah, you can use Safari instead. Camino seems to have some kind > of scriptable interface, too, though I have no idea how extensive it is. > > James > > On 19-Jun-07, at 4:54 AM | Jun 19, Nathaniel Brown wrote: > > > I get the following error.. > > > > [carbon:~/bin/dev] nshb% ./firefox.rb > > /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:643:in > > `__load_sdef__': No application class defined. (RuntimeError) > > from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/ > > rbosa.rb:464:in > > `__app__' > > from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/ > > rbosa.rb:329:in > > `app' > > from ./firefox.rb:7 > > > > With the following script... > > > > ---- > > > > #!/usr/bin/env ruby > > > > require 'rubygems' > > require 'rbosa' > > > > firefox = OSA.app(:bundle_id => 'org.mozilla.firefox') > > > > ---- > > > > Any idea how I can assign the application class? I checked out the > > script editor and couldn't find any reference to Firefox. Does this > > mean I can't access Firefox within OSA? > > > > I have in the interm switched to Safari, but would be nice to know why > > Firefox wouldn't work. Or even if it's not by default, how I can get > > it to work if that requires me to write up some code. > > > > Nathaniel. > > > > Nathaniel. > > > > -- > > Nathaniel Steven Henry Brown > > > > Toll Free: 1-877-446-4647 > > Vancouver: 604-724-6624 > > _______________________________________________ > > Rubyosa-discuss mailing list > > Rubyosa-discuss at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rubyosa-discuss > > --- > James MacAulay > jmacaulay at gmail.com > > http://jmacaulay.net > http://flickr.com/photos/jmacaulay > http://www.jadedpixel.com > > > _______________________________________________ > 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/20070619/a51578a3/attachment-0001.html From nshb at inimit.com Wed Jun 20 02:33:22 2007 From: nshb at inimit.com (Nathaniel Brown) Date: Tue, 19 Jun 2007 23:33:22 -0700 Subject: [Rubyosa-discuss] Safari document.loaded? Message-ID: There was mention of using the System Events to manage an application. Not sure if this is the right path, but I am currently trying to find out if the page has finished loading in Safari. I have looked up and down through the rdocs OSA generated, and no mention of this. Any ideas how I can get this working? One idea was having a while that loops through a sleep/return if statement incrementing the run_time variable checking to see if the document.source is available. Anyone see a more elegant way of doing this? Just this evening, hours before Jean mentioned the System Events I ran across a posting that mentioned it as well. Was pretty light on the example code, but showed that you can actually type into the browser with Ruby. Looks pretty awesome, pretty sure in this case it wouldn't do what I need tho. Nathaniel. -- Nathaniel Steven Henry Brown Toll Free: 1-877-446-4647 Vancouver: 604-724-6624 From kbrbosa at thebrocks.net Wed Jun 20 08:36:23 2007 From: kbrbosa at thebrocks.net (Keenan Brock) Date: Wed, 20 Jun 2007 08:36:23 -0400 Subject: [Rubyosa-discuss] No Firefox? In-Reply-To: References: Message-ID: <91506680706200536s11d01884id9d1358734556a6b@mail.gmail.com> Has anyone experimented with adding the scriptable elements via a plugin or something? (I'm also thinking about iPhoto) I do remember firefox had pretty limited windows activeX support as well. From jed.hurt at gmail.com Sun Jun 24 05:04:24 2007 From: jed.hurt at gmail.com (Jed Hurt) Date: Sun, 24 Jun 2007 03:04:24 -0600 Subject: [Rubyosa-discuss] Scripting Photoshop Message-ID: I have a somewhat complex scripting assignment in Photoshop: I have a folder of 250 portraits. I have to make name tags out of the portraits. I created a Photoshop document that has five name tag templates on a 8.5"x11" sheet (multiple name tags per sheet to save paper). I need to write a script that will: * Grab references to every file in a folder (returning an array of 250 paths in this case). 'Dir.glob("*.jpg")' seems like it should do the trick * Step over the array of file paths in_groups_of(5). Some ActiveSupport love? * For each group of five, open the name tag template sheet in Photoshop * Paste all five portraits as new layers into their correct location on the template sheet * 'Save as' the template sheet with a new name (five_nametags_001.jpg) * Step to the next group of five file paths, open a new template sheet, composite, save and so on I read Justin Palmer's Photoshop scripting tutorial and also looked at the Photoshop samples he checked into trunk. Unfortunately, for things that aren't covered in Justin's examples, translating the applescript methods myself is proving to be an exercise in futility. For example: I figured my first building block would be to simply get Photoshop to open a file. Using Justin's 'new_doc_with_text' example script as a base, I added this line: document = app.open('/Users/Meekish/Pictures/MyPhoto.jpg') ( full pastie here: http://pastie.caboo.se/73005 ) That's definitely the correct file path, but nothing happens (PhotoShop is running). Can the 'open' method take bare strings, or do I have to figure out how to fetch a file alias from Finder or something? I'm so lost. I'm confident that once I wrap my head around the AppleScript => RubyOSA syntax translation, scripts like this should be somewhat trivial to write. But right now, it seems like a monumental task. If anyone else who has spent some time scripting Photoshop (Justin?) could give me some insight on how I might write this script, it'd be much appreciated. Thanks! From nshb at inimit.com Sun Jun 24 19:11:40 2007 From: nshb at inimit.com (Nathaniel Brown) Date: Sun, 24 Jun 2007 16:11:40 -0700 Subject: [Rubyosa-discuss] Scripting Photoshop In-Reply-To: References: Message-ID: Why not just use batch processing with Adobe? Pretty sure most if not all of this can be done with that tool. Anything that can't OSA would be able to help on. On 6/24/07, Jed Hurt wrote: > I have a somewhat complex scripting assignment in Photoshop: > > I have a folder of 250 portraits. I have to make name tags out of the > portraits. I created a Photoshop document that has five name tag > templates on a 8.5"x11" sheet (multiple name tags per sheet to save > paper). > > I need to write a script that will: > > * Grab references to every file in a folder (returning an array of 250 > paths in this case). 'Dir.glob("*.jpg")' seems like it should do the > trick > * Step over the array of file paths in_groups_of(5). Some ActiveSupport love? > * For each group of five, open the name tag template sheet in Photoshop > * Paste all five portraits as new layers into their correct location > on the template sheet > * 'Save as' the template sheet with a new name (five_nametags_001.jpg) > * Step to the next group of five file paths, open a new template > sheet, composite, save and so on > > I read Justin Palmer's Photoshop scripting tutorial and also looked at > the Photoshop samples he checked into trunk. Unfortunately, for things > that aren't covered in Justin's examples, translating the applescript > methods myself is proving to be an exercise in futility. For example: > > I figured my first building block would be to simply get Photoshop to > open a file. Using Justin's 'new_doc_with_text' example script as a > base, I added this line: > > document = app.open('/Users/Meekish/Pictures/MyPhoto.jpg') > > ( full pastie here: http://pastie.caboo.se/73005 ) > > That's definitely the correct file path, but nothing happens > (PhotoShop is running). Can the 'open' method take bare strings, or do > I have to figure out how to fetch a file alias from Finder or > something? I'm so lost. > > I'm confident that once I wrap my head around the AppleScript => > RubyOSA syntax translation, scripts like this should be somewhat > trivial to write. But right now, it seems like a monumental task. > > If anyone else who has spent some time scripting Photoshop (Justin?) > could give me some insight on how I might write this script, it'd be > much appreciated. Thanks! > _______________________________________________ > Rubyosa-discuss mailing list > Rubyosa-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubyosa-discuss > -- Nathaniel Steven Henry Brown Toll Free: 1-877-446-4647 Vancouver: 604-724-6624 From jed.hurt at gmail.com Thu Jun 28 12:02:52 2007 From: jed.hurt at gmail.com (Jed Hurt) Date: Thu, 28 Jun 2007 10:02:52 -0600 Subject: [Rubyosa-discuss] Scripting Photoshop In-Reply-To: References: Message-ID: Hey Justin, 'Has' contacted me off-list and seduced me into using rb-appscript. Referencing the 'Photoshop CS3 Applescript Reference', I was able to paste a lot of the Applescript commands into ASTranslate ( https://sourceforge.net/project/showfiles.php?group_id=175009&release_id=518606 ) and get the relevant rb-appscript code. ASTranslate turned out to be an immensely helpful tool. Also, rb-appscript seems to be much more mature and has more documentationthan RubyOSA. Not to detract from RubyOSA. It's a very lovely library, I just couldn't figure out how to bend it to my will in this case. Here's the final script: http://pastie.caboo.se/74422. It's heavily commented, but feel free to ask if any part of it is unclear. I just hard coded the paths in the script, but it would certainly be simple enough to convert them to ARGV[0], ARGV[1], etc... And for the sake of clarity, here's the template file I was compositing with: http://imajr.com/Badge-Inside-Tops-Layout_142887 Thanks for all the help!