You will need to create a shape object and then add it to the correct container. something like:
shape = OmniGraffleShape.alloc.init canvas.shapes.addObject shape The different shape classes can be views by generating the OmniGraffle scriptingbridge header with: sdef /Path/To/OmniGraffle.app | sdp -fh -o /header/save/path -A --basename OmniGraffle You may also want to generate the .bridgesupport file gen_bridge_metadata -c '-I/Path/To/OmniGraffle.h' -o /path/to/save/OmniGraffle.bridgesupport And include that bridgsupport file in your script with load_bridge_support_file '/path/to/OmniGraffle.bridgesupport' Matt has a great article on using ScriptingBridge with MacRuby: http://merbist.com/2010/01/17/controlling-itunes-with-macruby/ hth kam On Nov 14, 2011, at 3:06 PM, Sophie wrote: > I am trying to automate OmniGraffle using MacRuby, and cannot figure out how > to map Applescript to available MacRuby methods. For example, to add a shape > takes roughly this Applescript: > > tell application "OmniGraffle Professional" > tell canvas of front window > make new shape at end of graphics with properties {size: > {10,80}, origin: {9,9}} > end tell > end tell > > I can get a handle on the OmniGraffle application, on its document, canvas, > etc. Can get a list of methods as below. But cannot find anything > corresponding to the above "make new shape". > > Is there any way to browse a MacRuby view of the scripting dictionary? > > Thanks for any pointers! > > Sophie > > framework 'ScriptingBridge' > > $omni = > SBApplication.applicationWithBundleIdentifier("com.omnigroup.OmniGrafflePro") > > $document = $omni.windows[0].document > > $canvas = $omni.windows[0].canvas > > $canvas.methods(true,true).sort > > => [:adjustsPages, :"assembleSubgraph:tableShape:", :bold, :canvasBackground, > :canvasSize, :"childWithClass:code:keyForm:keyData:", > :"childWithClass:code:keyForm:keyData:length:type:", > :"childWithClass:code:keyForm:keyData:type:", > :"childWithClass:code:keyForm:keyDesc:", :"closeSaving:savingIn:", > :columnAlignment, :columnSpacing, :"connectTo:withProperties:", :context, > :delete, :descriptionForSpecifier, :"duplicateTo:withProperties:", > :elementArrayWithCode, :"elementWithCode:ID:", :"elementWithCode:atIndex:", > :"elementWithCode:named:", :encodeWithCoder, :exists, :flipOver, :get, > :graphics, :grid, :groups, :horizontalPages, :id, > :"importCategories:frameworks:instanceVariableTypes:instanceVariables:interactionAllowed:mapping:methodSignatures:methods:outlineTemplate:protocols:", > :"initWithApplication:specifier:", :"initWithClass:properties:data:", > :initWithCoder, :"initWithContext:specifier:", :initWithData, > :"initWithElementCode:properties:data:", :initWithProperties, :isRang eS > pecifier, :italicize, :lastError, :layers, :layout, :layoutInfo, :lines, > :moveTo, :objectClass, :pageAdjust, :pageSize, :positionAfter, > :positionBefore, :properties, :"propertyWithClass:code:", :propertyWithCode, > :qualifiedSpecifier, :qualify, > :"replaceReplacement:ignoreCase:regexp:string:wholeWords:", :rowAlignment, > :rowSpacing, :"saveAs:in:", :"sendEvent:id:format:", > :"sendEvent:id:parameters:", :setAdjustsPages, :setCanvasSize, > :setColumnAlignment, :setColumnSpacing, :setGrid, :setHorizontalPages, > :setId, :setLastError, :setLayoutInfo, :setName, :setProperties, > :setRowAlignment, :setRowSpacing, :setTo, :setVerticalPages, :shapes, > :slideBy, :solids, :specifier, :specifierDescription, :subgraphs, :unbold, > :underline, :unitalicize, :ununderline, :verticalPages] > > > > > > > On Nov 14, 2011, at 11:19 AM, macruby-devel-requ...@lists.macosforge.org > wrote: > >> Send MacRuby-devel mailing list submissions to >> macruby-devel@lists.macosforge.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> or, via email, send a message with subject or body 'help' to >> macruby-devel-requ...@lists.macosforge.org >> >> You can reach the person managing the list at >> macruby-devel-ow...@lists.macosforge.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of MacRuby-devel digest..." >> >> >> Today's Topics: >> >> 1. Write your own version of Siri in MacRuby (Matt Aimonetti) >> 2. Re: MacRuby promise (Jean-Denis MUYS) >> 3. Re: MacRuby promise (Matt Aimonetti) >> 4. Re: MacRuby promise (Nat Brown) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Mon, 14 Nov 2011 13:57:10 -0300 >> From: Matt Aimonetti <mattaimone...@gmail.com> >> To: "MacRuby development discussions." >> <macruby-devel@lists.macosforge.org> >> Subject: [MacRuby-devel] Write your own version of Siri in MacRuby >> Message-ID: >> <CAFGi+5fWTZ=faQCmhSokYvHWBE_Yae==fu+wsrr-fsh-zic...@mail.gmail.com> >> Content-Type: text/plain; charset="utf-8" >> >> I extracted an old demo I had made for RubyConf which shows how to use the >> voice recognizer feature of OS X to implement an app which could be the >> Siri equivalent for OS X: >> https://github.com/mattetti/MacRuby-Siri >> >> The code is straight forward, the app runs in the top menu. Don't forget to >> turn on the voice recognition feature before testing the app. >> >> - Matt >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111114/e9caacd7/attachment-0001.html> >> >> ------------------------------ >> >> Message: 2 >> Date: Mon, 14 Nov 2011 17:09:25 +0000 >> From: Jean-Denis MUYS <jdm...@kleegroup.com> >> To: "<macruby-devel@lists.macosforge.org>" >> <macruby-devel@lists.macosforge.org> >> Subject: Re: [MacRuby-devel] MacRuby promise >> Message-ID: <00c61b47-0a9a-45b8-bd77-118105e8b...@kleegroup.com> >> Content-Type: text/plain; charset="us-ascii" >> >> >> On 14 nov. 2011, at 17:54, >> <macruby-devel-requ...@lists.macosforge.org<mailto:macruby-devel-requ...@lists.macosforge.org>> >> wrote: >> >> Date: Mon, 14 Nov 2011 08:53:14 -0800 >> From: Nat Brown <nat...@gmail.com<mailto:nat...@gmail.com>> >> To: "MacRuby development discussions." >> <macruby-devel@lists.macosforge.org<mailto:macruby-devel@lists.macosforge.org>> >> Subject: Re: [MacRuby-devel] MacRuby promise >> Message-ID: >> <cag9ekxucdh03nx8numzzrdb2c9a7yhtnwaguzrf0ovowhce...@mail.gmail.com<mailto:cag9ekxucdh03nx8numzzrdb2c9a7yhtnwaguzrf0ovowhce...@mail.gmail.com>> >> Content-Type: text/plain; charset="iso-8859-1" >> >> this would certainly be useful, but frankly i think that having proper >> debugger-integration support in xcode (see >> http://www.macruby.org/trac/ticket/1208 and issue 3037631 in >> http://bugreporter.apple.com<http://bugreporter.apple.com/>) would go >> dramatically farther towards making >> macruby useful. edit-and-continue would be great, but setting a breakpoint: >> priceless. thx, n@ >> >> This is a false dichotomy: my suggestion and yours are orthogonal (except >> perhaps for resource allocation consideration). >> >> You are right of course that proper debugging is desirable (MCL also had >> that 20 years ago), perhaps more so than what I am suggesting, but I'm going >> for the low-hanging fruits here. Moreover, adding Ruby debugging to Xcode >> would require Apple willingness to evolve Xcode which, given the glacial >> pace of Xcode 4 bug fixing and almost total deafness to developer requests, >> is far too much to ask. What I describe on the other hand, require no such >> cooperation. I probably even could implement a rough bare bone version. >> >> Jean-Denis >> >> >> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111114/cb8d11a2/attachment-0001.html> >> >> ------------------------------ >> >> Message: 3 >> Date: Mon, 14 Nov 2011 14:10:59 -0300 >> From: Matt Aimonetti <mattaimone...@gmail.com> >> To: "MacRuby development discussions." >> <macruby-devel@lists.macosforge.org> >> Subject: Re: [MacRuby-devel] MacRuby promise >> Message-ID: >> <CAFGi+5ckDAzpX=rhm3qei1+yshgnkkfeoxbxw76p2try5gx...@mail.gmail.com> >> Content-Type: text/plain; charset="utf-8" >> >>> >>> I probably even could implement a rough bare bone version. >> >> >> I'm currently traveling but I would be glad to assist you. >> >> - Matt >> >> >> >> On Mon, Nov 14, 2011 at 2:09 PM, Jean-Denis MUYS <jdm...@kleegroup.com>wrote: >> >>> >>> On 14 nov. 2011, at 17:54, <macruby-devel-requ...@lists.macosforge.org> >>> wrote: >>> >>> Date: Mon, 14 Nov 2011 08:53:14 -0800 >>> From: Nat Brown <nat...@gmail.com> >>> To: "MacRuby development discussions." >>> <macruby-devel@lists.macosforge.org> >>> Subject: Re: [MacRuby-devel] MacRuby promise >>> Message-ID: >>> <cag9ekxucdh03nx8numzzrdb2c9a7yhtnwaguzrf0ovowhce...@mail.gmail.com> >>> Content-Type: text/plain; charset="iso-8859-1" >>> >>> >>> this would certainly be useful, but frankly i think that having proper >>> debugger-integration support in xcode (see >>> http://www.macruby.org/trac/ticket/1208 and issue 3037631 in >>> http://bugreporter.apple.com) would go dramatically farther towards making >>> macruby useful. edit-and-continue would be great, but setting a breakpoint: >>> priceless. thx, n@ >>> >>> >>> This is a false dichotomy: my suggestion and yours are orthogonal >>> (except perhaps for resource allocation consideration). >>> >>> You are right of course that proper debugging is desirable (MCL also had >>> that 20 years ago), perhaps more so than what I am suggesting, but I'm >>> going for the low-hanging fruits here. Moreover, adding Ruby debugging to >>> Xcode would require Apple willingness to evolve Xcode which, given the >>> glacial pace of Xcode 4 bug fixing and almost total deafness to developer >>> requests, is far too much to ask. What I describe on the other hand, >>> require no such cooperation. I probably even could implement a rough bare >>> bone version. >>> >>> Jean-Denis >>> >>> >>> >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111114/b052238b/attachment-0001.html> >> >> ------------------------------ >> >> Message: 4 >> Date: Mon, 14 Nov 2011 09:19:23 -0800 >> From: Nat Brown <nat...@gmail.com> >> To: "MacRuby development discussions." >> <macruby-devel@lists.macosforge.org> >> Subject: Re: [MacRuby-devel] MacRuby promise >> Message-ID: >> <cag9ekxupgyqoauxsifqctknknc0zms_+uuzet8msqe0xyyx...@mail.gmail.com> >> Content-Type: text/plain; charset="iso-8859-1" >> >> you are right, of course -- these two issues are orthogonal, I simply never >> pass up a chance to rant about lack of debug support on the off chance that >> everybody will up-vote this issue and we'll see it get fixed before another >> 5 years pass. >> if you implement your suggestion, i will certainly try it -- i have a >> similar simple jury-rigged editing/eval app which i use for writing ruby >> scripts which is radically faster than copying and pasting >> classes/functions from an editor into irb and re-running, and faster than >> background running from e.g. vi or textmate, but it's not suitable for a >> full app with resources, and your proposed solution would be. >> thx, n@ >> >> On Mon, Nov 14, 2011 at 9:09 AM, Jean-Denis MUYS <jdm...@kleegroup.com>wrote: >> >>> >>> This is a false dichotomy: my suggestion and yours are orthogonal >>> (except perhaps for resource allocation consideration). >>> >>> You are right of course that proper debugging is desirable (MCL also had >>> that 20 years ago), perhaps more so than what I am suggesting, but I'm >>> going for the low-hanging fruits here. Moreover, adding Ruby debugging to >>> Xcode would require Apple willingness to evolve Xcode which, given the >>> glacial pace of Xcode 4 bug fixing and almost total deafness to developer >>> requests, is far too much to ask. What I describe on the other hand, >>> require no such cooperation. I probably even could implement a rough bare >>> bone version. >>> >>> Jean-Denis >>> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111114/cb03e6b4/attachment.html> >> >> ------------------------------ >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> >> >> End of MacRuby-devel Digest, Vol 45, Issue 20 >> ********************************************* >> > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel