Re: [MacRuby-devel] MacRuby: The Definitive Guide

2011-11-03 Thread Takao Kouji
+1
I bought the iBooks, so I bring it everyday :) Thanks.

On 2011/11/02, at 19:46, Matt Aimonetti wrote:

> Hey guys, if you pre ordered the hard copy of my book, it should arrive in a 
> few days (just got mine).
> Otherwise you can buy from O'Reilly: 
> http://shop.oreilly.com/product/063692723.do or Amazon: 
> http://amzn.to/tVx4ng (cheaper)
> Digital versions are available on the iBooks and Kindle marketplaces and 
> available in a all included format package on the O'Reilly website.
> 
> I would sincerely appreciate if some of you could leave reviews on Amazon or 
> O'Reilly, especially if my writing managed to help you out in the past.
> 
> 
> Thanks,
> 
> - Matt
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

---
TAKAO Kouji 
blog: http://d.hatena.ne.jp/kouji0625/
twitter: takaokouji / projects: ruby, s7-seven

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


Re: [MacRuby-devel] MacRuby: The Definitive Guide

2011-11-03 Thread Conrad Taylor
On Thu, Nov 3, 2011 at 3:48 AM, Takao Kouji  wrote:

> +1
> I bought the iBooks, so I bring it everyday :) Thanks.
>
> On 2011/11/02, at 19:46, Matt Aimonetti wrote:
>
> > Hey guys, if you pre ordered the hard copy of my book, it should arrive
> in a few days (just got mine).
> > Otherwise you can buy from O'Reilly:
> http://shop.oreilly.com/product/063692723.do or Amazon:
> http://amzn.to/tVx4ng (cheaper)
> > Digital versions are available on the iBooks and Kindle marketplaces and
> available in a all included format package on the O'Reilly website.
> >
> > I would sincerely appreciate if some of you could leave reviews on
> Amazon or O'Reilly, especially if my writing managed to help you out in the
> past.
> > 
> >
> > Thanks,
> >
> > - Matt
>

Matt, it's great to hear that you have written a book and I look forward to
reading it.

-Conrad


> > ___
> > MacRuby-devel mailing list
> > [email protected]
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ---
> TAKAO Kouji 
> blog: http://d.hatena.ne.jp/kouji0625/
> twitter: takaokouji / projects: ruby, s7-seven
>
> ___
> 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: The Definitive Guide

2011-11-03 Thread Jean-Denis MUYS

On 3 nov. 2011, at 13:28, Matt Aimonetti 
mailto:[email protected]>>
 wrote:

Date: Wed, 2 Nov 2011 19:46:42 -0700
From: Matt Aimonetti mailto:[email protected]>>
To: "MacRuby development discussions."
mailto:[email protected]>>
Subject: [MacRuby-devel] MacRuby: The Definitive Guide
Message-ID:
mailto:CAFGi+5eZNN=ks7q8opssne2pc0sdty+2g_pdfl5vwm9suaa...@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

Hey guys, if you pre ordered the hard copy of my book, it should arrive in
a few days (just got mine).
Otherwise you can buy from O'Reilly:
http://shop.oreilly.com/product/063692723.do or Amazon:
http://amzn.to/tVx4ng (cheaper)
Digital versions are available on the iBooks and Kindle marketplaces and
available in a all included format package on the O'Reilly website.

I would sincerely appreciate if some of you could leave reviews on Amazon
or O'Reilly, especially if my writing managed to help you out in the past.


Thanks,

- Matt

I just posted the following review to the Amazon page:

If you are:

- a Ruby developer who would like to learn Cocoa and program for the Mac

or

- a Cocoa Mac developer who would like to learn programming with Ruby

then you could do a lot worse than reading Matt Aimonetti's book. It gets 
exactly what's useful by focusing on programming for Mac, on the Mac, using 
MacRuby. So it doesn't want to teach you Ruby or Cocoa. There are other books 
for that. Instead it focuses on the specific stuff:

- What's different when programming in Ruby from programming in Objective-C
- How to use Mac tools, e.g. Xcode, to develop in Ruby for the Mac
- How the MacRuby runtime is using and integrates with the Objective-C runtime
- How to call Ruby code from Objective-C and back
- How to benefit from the interpreted nature of Ruby within a Cocoa app

and so on.

A very interesting look into what the future of Mac programming (and hopefully 
iOS). It helped me get up to speed very quickly with MacRuby (now included with 
OS X Lion) and saved me a *lot* of time, probably weeks. I am an inexperienced 
Ruby programmer, but a seasoned Cocoa programmer. I think that it would be 
equally useful to an experienced Ruby programmer getting started with Mac 
development.

Highly recommended

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


Re: [MacRuby-devel] MacRuby: The Definitive Guide

2011-11-03 Thread Matt Aimonetti
Thank you Jean-Denis, I really appreciate it.

- Matt

On Thu, Nov 3, 2011 at 6:30 AM, Jean-Denis MUYS wrote:

>
>  On 3 nov. 2011, at 13:28, Matt Aimonetti 
>  wrote:
>
>  Date: Wed, 2 Nov 2011 19:46:42 -0700
> From: Matt Aimonetti 
> To: "MacRuby development discussions."
> 
> Subject: [MacRuby-devel] MacRuby: The Definitive Guide
> Message-ID:
> 
> Content-Type: text/plain; charset="utf-8"
>
>
> Hey guys, if you pre ordered the hard copy of my book, it should arrive in
> a few days (just got mine).
> Otherwise you can buy from O'Reilly:
> http://shop.oreilly.com/product/063692723.do or Amazon:
> http://amzn.to/tVx4ng (cheaper)
> Digital versions are available on the iBooks and Kindle marketplaces and
> available in a all included format package on the O'Reilly website.
>
> I would sincerely appreciate if some of you could leave reviews on Amazon
> or O'Reilly, especially if my writing managed to help you out in the past.
> 
>
> Thanks,
>
> - Matt
>
>
>  I just posted the following review to the Amazon page:
>
>  If you are:
>
> - a Ruby developer who would like to learn Cocoa and program for the Mac
>
> or
>
> - a Cocoa Mac developer who would like to learn programming with Ruby
>
> then you could do a lot worse than reading Matt Aimonetti's book. It gets
> exactly what's useful by focusing on programming for Mac, on the Mac, using
> MacRuby. So it doesn't want to teach you Ruby or Cocoa. There are other
> books for that. Instead it focuses on the specific stuff:
>
> - What's different when programming in Ruby from programming in
> Objective-C
> - How to use Mac tools, e.g. Xcode, to develop in Ruby for the Mac
> - How the MacRuby runtime is using and integrates with the Objective-C
> runtime
> - How to call Ruby code from Objective-C and back
> - How to benefit from the interpreted nature of Ruby within a Cocoa app
>
> and so on.
>
> A very interesting look into what the future of Mac programming (and
> hopefully iOS). It helped me get up to speed very quickly with MacRuby (now
> included with OS X Lion) and saved me a *lot* of time, probably weeks. I am
> an inexperienced Ruby programmer, but a seasoned Cocoa programmer. I think
> that it would be equally useful to an experienced Ruby programmer getting
> started with Mac development.
>
> Highly recommended
>
>
> ___
> 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 Bridge

2011-11-03 Thread Spencer Rose
So final question, now that I downloaded the updates to scripting 
bridge, and it compiles fine, I still get errors such 
as: `': undefined method `exportFormat' this is right after 
running your "doc.packageTo" method which worked great.  I got 
the exportFormat method and other methods I have tried directly 
from my indesign.spriptingbridge file. A few of the methods in there 
are working, most are giving me an "undefinded method" error.  
I think the error is because my parameter syntax is off.  When I 
changed the parameter syntax on the one you made work I got the 
same error.  So how do I know the right syntax?

exportFormat:
to:
-showingOptions:
using:
versionComments:
-forceSave:

 -showingOptions:
 -forceSave:

packageTo:

 - copyingFonts:
 - copyingLinkedGraphics:
 - copyingProfiles:
 - updatingGraphics:
 - includingHiddenLayers:
 - ignorePreflightErrors:
 - creatingReport:
 - versionComments:

 - forceSave:

exportFormat:to:showingOptions:using:versionComments:forceSave:

-
packageTo:copyingFonts:copyingLinkedGraphics:copyingProfiles:
-

-
updatingGraphics:includingHiddenLayers:ignorePreflightErrors:
creatingReport:versionComments:forceSave:
-

I figure the index numbers means the position of the param in the list.
This has not worked perfectly and yours did not seem to match up perfectly
or else I am missing something.  How do we figure out syntax for these other
than trial and error?  Thanks



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


Re: [MacRuby-devel] Scripting Bridge

2011-11-03 Thread Spencer Rose
And now I am reading chapter 8 of your book again because
I remembered something about noMethodErrors and selectors.

Starting to make sense.  Stay tuned.  :)

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


Re: [MacRuby-devel] Scripting Bridge

2011-11-03 Thread Matt Aimonetti
If you call "methods(true, true).grep /export/i" on one of your objects and
you get a method signature such as:
exportFormat:to:showingOptions:using:versionComments:forceSave:

That means you need to call it as shown in my example:
page.exportFormat("tagged text/PDF", to:"/Users/mattetti/tmp/page2.pdf",
showingOptions: false, using: app.PDFExportPresets.first, versionComments:
"test", forceSave: true)

Which is like calling a method with a param and a hash of params with the
keys of the hash being the selector elements (it uses Ruby 1.9's hash
format).
exportFormat(param, key: value, key: value, key: value)

If you look at the indesign header file the function signature looks like
that:

- (void) *exportFormat*:(id)format *to:*(id)to *showingOptions:*(BOOL)
showingOptions *using:*(inDesignPDFExportPreset *)using_
*versionComments:*(NSString
*)versionComments *forceSave:*(BOOL)forceSave;  // Exports the object(s) to
a file.

In blue, you can see the expected type, in bold the method signature and in
gray the named given to the params (not important).


I figure the index numbers means the position of the param in the list.
> This has not worked perfectly and yours did not seem to match up perfectly
> or else I am missing something.  How do we figure out syntax for these
> other
> than trial and error?



I opened up a macirb session and used Ruby's introspection tools +
applescript editor which has some extra hints on the expected params.
For instance, I got a page object and I did:

>> methods = (page.method(true, true) - Object.new(true, true)).sort

That would give you an array of all the methods available on "page", for
the params, I referred to header file and the applescript editor dictionary
doc.
I can't find the small script I wrote, but writing a simple/dumb parser for
the obj-c header file that would give you a proper documentation for all
methods available should be very trivial. (I'm about to take off for a long
flight, I might work on that if my 16 months daughter decides to sleep for
most of the trip ;))

The bottom line is that using BridgeScript is harder that it should be
especially when the provided APIs aren't well designed. Ars Technical has a
good tutorial on how to script safari and evernote:
http://arstechnica.com/apple/guides/2011/09/tutorial-os-x-automation-with-macruby-and-the-scripting-bridge.ars

An app that would let you pick a 3rd party app and would run sdef/sdp, let
you browse the classes/functions, read the comments and generate a BS file
would be of a huge help.

Another thing that would be great is MacRuby support for OSA
http://en.wikipedia.org/wiki/AppleScript#Open_Scripting_Architecture
http://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptX/Concepts/osa.html

I believe this is something Laurent still wants to have in for 1.0.

- Matt





On Thu, Nov 3, 2011 at 4:34 PM, Spencer Rose  wrote:

> And now I am reading chapter 8 of your book again because
> I remembered something about noMethodErrors and selectors.
>
> Starting to make sense.  Stay tuned.  :)
>
> ___
> 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