Adobe Illustrator scripting with MacRuby
Can anyone post an example of how to add (1) a layer and (2) a path object to an Adobe Illustrator document? I am able to do these things using rb-appscript with Ruby 1.8, but have not been successful with MacRuby and ScriptingBridge. I have also failed trying to get appscript to work with MacRuby. This works (irb): irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'appscript' => true irb(main):003:0> include Appscript => Object irb(main):004:0> ai = app('Adobe Illustrator') => app("/Applications/Adobe Illustrator CS3/Adobe Illustrator.app") irb(main):005:0> doc = ai.documents[1] => app("/Applications/Adobe Illustrator CS3/Adobe Illustrator.app").documents[1] irb(main):006:0> doc.name.get => "Sample.ai" irb(main):007:0> doc.make(:new => :layer, :with_properties => {:name => 'Test'}) => app("/Applications/Adobe Illustrator CS3/Adobe Illustrator.app").documents[1].layers[1] I get this far with macirb:
framework 'ScriptingBridge' => true ai = SBApplication.applicationWithBundleIdentifier('com.adobe.illustrator') => #<AdobeIllustratorApplication:0x800b5fcc0> doc = ai.currentDocument => #<AdobeIllustratorDocument:0x800d1f740> doc.name => "Sample.ai"
I can query and set properties on my Illustrator documents, no problem. It is creating new objects that is not working for me. I am running plain-vanilla MacRuby 0.4 on a 2 x 2.8 Quad-Core Xeon, OS 10.5.7. Thanks in advance, - Chris
participants (1)
-
Chris Brown