[MacRuby-devel] Scripting OmniGraffle

Matt Aimonetti mattaimonetti at gmail.com
Tue Nov 15 11:57:36 PST 2011


Sophie, alloc.init is the same as new in Ruby and probably make  in
applescript. Basically, alloc allocate an object of a given type and
initialize it.
All instances of a class can be initiated using alloc.init.
If you look at my previous post, I started working on an application that
document the ScriptingBrige interfaces, here is a screenshot:
https://img.skitch.com/20111115-dy4wrh9ppbybhxm4j4xn33ip9h.jpg

>From what I'm seeing the code you pasted missed a way to fetch the "canvas"
object.
But "canvas" is an instance of Omnicanvas which has a #shapes method
returning an array to which Kam adds the shape previously created.

I hope that helps.

- Matt

On Tue, Nov 15, 2011 at 4:43 PM, Sophie <itsme213 at hotmail.com> wrote:

> Sorry for the sloppy subject line in my earlier question.
>
> Thanks, Kam, Matt for your very helpful replies.
>
> Kam, any idea how I would initialize the alloc'd shape to be e.g. a Circle
> of some size at some position?
>
> I generated the files with sdef & gen_bridge_metadata, found lots of
> useful things there. Is there something in these files that would lead me
> to:
>
> shape = OmniGraffleShape.alloc.init
> canvas.shapes.addObject shape
>
> ?  I don't see either alloc or init, or addObject in the 2 files.
>
> Also, is there some reason why there is no corresponding "make ..." method
> in either file? Applescript gladly seems to call "make" (so does Ruby
> Appscript) on doc, canvas, or layer ... but I'm no Applescript guru :-(
>
> Thanks !!
>
>
> _______________________________________________
> 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/20111115/eda0861f/attachment.html>


More information about the MacRuby-devel mailing list