[MacRuby-devel] MacRuby-devel Digest, Vol 45, Issue 20

Sophie itsme213 at hotmail.com
Mon Nov 14 15:06:02 PST 2011


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 at lists.macosforge.org wrote:

> Send MacRuby-devel mailing list submissions to
> 	macruby-devel at 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 at lists.macosforge.org
> 
> You can reach the person managing the list at
> 	macruby-devel-owner at 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 at gmail.com>
> To: "MacRuby development discussions."
> 	<macruby-devel at lists.macosforge.org>
> Subject: [MacRuby-devel] Write your own version of Siri in MacRuby
> Message-ID:
> 	<CAFGi+5fWTZ=faQCmhSokYvHWBE_Yae==fu+wsrr-FSH-ZicrPw at 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 <jdmuys at kleegroup.com>
> To: "<macruby-devel at lists.macosforge.org>"
> 	<macruby-devel at lists.macosforge.org>
> Subject: Re: [MacRuby-devel] MacRuby promise
> Message-ID: <00C61B47-0A9A-45B8-BD77-118105E8B081 at kleegroup.com>
> Content-Type: text/plain; charset="us-ascii"
> 
> 
> On 14 nov. 2011, at 17:54, <macruby-devel-request at lists.macosforge.org<mailto:macruby-devel-request at lists.macosforge.org>>
> wrote:
> 
> Date: Mon, 14 Nov 2011 08:53:14 -0800
> From: Nat Brown <natbro at gmail.com<mailto:natbro at gmail.com>>
> To: "MacRuby development discussions."
> <macruby-devel at lists.macosforge.org<mailto:macruby-devel at lists.macosforge.org>>
> Subject: Re: [MacRuby-devel] MacRuby promise
> Message-ID:
> <CAG9EKxucdh03nX8NumZZrDB2C9A7yHTNwaguzRF0oVoWHCev_A at mail.gmail.com<mailto:CAG9EKxucdh03nX8NumZZrDB2C9A7yHTNwaguzRF0oVoWHCev_A at 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 <mattaimonetti at gmail.com>
> To: "MacRuby development discussions."
> 	<macruby-devel at lists.macosforge.org>
> Subject: Re: [MacRuby-devel] MacRuby promise
> Message-ID:
> 	<CAFGi+5ckDAzpX=rHm3Qei1+ySHGNKkFEOxBxW76p2TrY5gXKwQ at 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 <jdmuys at kleegroup.com>wrote:
> 
>> 
>> On 14 nov. 2011, at 17:54, <macruby-devel-request at lists.macosforge.org>
>> wrote:
>> 
>> Date: Mon, 14 Nov 2011 08:53:14 -0800
>> From: Nat Brown <natbro at gmail.com>
>> To: "MacRuby development discussions."
>> <macruby-devel at lists.macosforge.org>
>> Subject: Re: [MacRuby-devel] MacRuby promise
>> Message-ID:
>> <CAG9EKxucdh03nX8NumZZrDB2C9A7yHTNwaguzRF0oVoWHCev_A at 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 at 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 <natbro at gmail.com>
> To: "MacRuby development discussions."
> 	<macruby-devel at lists.macosforge.org>
> Subject: Re: [MacRuby-devel] MacRuby promise
> Message-ID:
> 	<CAG9EKxuPGyQoAuXsifqcTkNknc0ZMS_+UuZET8mSQE0XYYX2Ag at 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 <jdmuys at 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 at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> 
> End of MacRuby-devel Digest, Vol 45, Issue 20
> *********************************************
> 



More information about the MacRuby-devel mailing list