Re: [MacRuby-devel] Write your own version of Siri in MacRuby

2011-11-15 Thread Eloy Duran
There’s also James by Florian Hanke: https://github.com/floere/james

On Mon, Nov 14, 2011 at 5:57 PM, Matt Aimonetti  wrote:
> 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
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Write your own version of Siri in MacRuby

2011-11-15 Thread Matt Aimonetti
Nice, Florian's version is much more complete, mine is merely an example to get 
people started.

-m
Sent from my iPhone

On Nov 15, 2011, at 7:14, Eloy Duran  wrote:

> There’s also James by Florian Hanke: https://github.com/floere/james
> 
> On Mon, Nov 14, 2011 at 5:57 PM, Matt Aimonetti  
> wrote:
>> 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
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] ScriptingBridge browser project

2011-11-15 Thread Matt Aimonetti
Since a few of you asked about ScriptingBridge within the last week or so,
I started working on a very very very basic app showing you the available
methods.
I don't have much free time so I really expect you guys to pick it up and
make it awesome.

Here is a screenshot of what I have so far:
https://img.skitch.com/2015-dy4wrh9ppbybhxm4j4xn33ip9h.jpg
Source code: https://github.com/mattetti/MacRuby-ScriptingBridge-Browser

At the moment, the header file is hardcoded instead of being generated on
the fly using sdef/sdp, the methods/properties documentation doesn't show
yet, there isn't any REPL setup, the constants are missing and I'm pretty
sure the hacked up parser is buggy.

Hopefully that will be enough to get some of you excited and involved with
this project.

- Matt
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] MacRuby promise delivered

2011-11-15 Thread Jean-Denis MUYS
Following up on my Friday suggestion, I am happy to announce that I implemented 
a first version a Xcode MacRuby projects that dynamically reloads Ruby source 
code into a running application, allowing for a very dynamic incremental 
programming style.

go to https://github.com/jdmuys/MacRubyReload to download the project. The 
ReadMe.markDown text file gives full instructions.

Hopefully MacRuby Xcode templates can evolve to automatically provide a similar 
facility.

This is all very simple and very primitive. There is a lot of room for 
improvement. I also apologize for my Ruby style: I probably haven't written 
more than 100 or so lines of Ruby code overall yet.

I hope this gets the ball rolling.

Jean-Denis

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Scripting OmniGraffle

2011-11-15 Thread Sophie
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
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Scripting OmniGraffle

2011-11-15 Thread Matt Aimonetti
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/2015-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  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
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby promise delivered

2011-11-15 Thread Matt Aimonetti
This is great Jean-Denis, thanks a lot.
A few notes, if you look at:
https://github.com/jdmuys/MacRubyReload/blob/master/MacRubyReload/AppDelegate.rb#L17-18
You don't need to end your lines of code by a semi colon and when using
puts, a return carriage is automatically used (use print if you don't want
that behavior).

- Matt

On Tue, Nov 15, 2011 at 3:01 PM, Jean-Denis MUYS wrote:

> Following up on my Friday suggestion, I am happy to announce that I
> implemented a first version a Xcode MacRuby projects that dynamically
> reloads Ruby source code into a running application, allowing for a very
> dynamic incremental programming style.
>
> go to https://github.com/jdmuys/MacRubyReload to download the project.
> The ReadMe.markDown text file gives full instructions.
>
> Hopefully MacRuby Xcode templates can evolve to automatically provide a
> similar facility.
>
> This is all very simple and very primitive. There is a lot of room for
> improvement. I also apologize for my Ruby style: I probably haven't written
> more than 100 or so lines of Ruby code overall yet.
>
> I hope this gets the ball rolling.
>
> Jean-Denis
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Scripting OmniGraffle

2011-11-15 Thread Kam Dahlin
Hi Sophie,

Here is a little example, that I hope makes things more clear.

graffle = 
SBApplication.applicationWithBundleIdentifier("com.omnigroup.OmniGrafflePro")

win = graffle.windows.first
canvas = win.canvas

circle = 
OmniGraffleProfessionalShape.alloc.initWithProperties({:name=>"Circle", 
:origin=>[100.00, 100.00], :size=>[300, 300]})
canvas.shapes.addObject(circle)

The example above uses the class name that should match what is in the header 
file that you generated. 

You can also use a slightly different method for getting the correct class:

circle = 
graffle.classForScriptingClass("shape").alloc.initWithProperties({:name=>"Circle",
 :origin=>[100.00, 100.0], :size=>[300.0, 300.0]})

the -classForScriptingClass method takes the name of the class you would use in 
Applescript and then returns the class that the ScriptingBridge machinery 
expects. Just a slightly different approach and useful if you know the name of 
the class you would use in Applescript, but not the actual name used by 
ScriptingBridge.

If you look in the header that you generated for OmniGraffle, you will see a 
bunch of @property declarations in each of the class definitions. The names of 
these properties you use as the keys in the initWithProperties method. 
Alternately you could also do:

circle = OmniGraffleProfessionalShape.alloc.init
canvas.shapes.addObject(circle)
circle.setName("Circle")
circle.setOrigin([100.0, 100.0])
circle.setSize([300.0, 300.0])

If you are going to set properties on an object, it must be added to a 
container first. 

Most of this is explained pretty well in the ScriptingBridge documentation, 
which is probably worth a look: 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/AboutScriptingBridge/AboutScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH3-SW9

hth
kam

P.S. the origin and size properties are actually defined as part of the 
OmniGraffleProfessionalGraphic class which OmniGraffleProfessionalShape 
inherits from.

On Nov 15, 2011, at 11:43 AM, Sophie 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
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel