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, :isRangeSpecifier, :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-request@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-request@lists.macosforge.org
You can reach the person managing the list at macruby-devel-owner@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 <mattaimonetti@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-ZicrPw@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