Let me say right off the bat- JSTalk isn't a replacement for AppleScript. I don't think anything will ever replace AppleScript and some of the amazing things I've seen done with it (especially in the publishing world). But I think of AppleScript in the same way as the original Macintosh Toolbox and Carbon after it. AppleScript was good in its day, but the time has come for something new. Something that doesn't require using a strange language, crufty apple events, or writing xml files to describe your object model. I want a language with momentum and resources behind it. I want something easy to setup and debug, where I can peek under the covers when things goes wrong.
JSTalk's goal can described like this: JSTalk is to AppleScript, what Cocoa is to Carbon.
I know, I know. It's a lofty, crazy goal. But someone has do try and it doesn't look like the solution is coming from Apple anytime soon. So I'm keeping it very simple, and very easy.
Adding this ability to Sketch was about 7 lines of code, and adding the JSTalk framework to it. Seriously. No XML files, no four character event codes, and I didn't even have to sacrifice a goat to get it to work.
(icon by Brad Ellis)
One of the things that has always bothered me about PyObjC and other Cocoa bridged scripting languages, is that I wasn't writing in Objective-C. The funny looking method names always bothered me:
What's with all the _'s in the method names?
Well, yes- I do know what's with all the underscores. And I know they are necessary so the bridge can convert the method names into Objective-C selectors, but it doesn't look or feel very Cocoa like to me. And since I'm using Cocoa APIs, and talking to Cocoa applications, I want to write in the same style as Cocoa uses, like so:
And that's my favorite part about JSTalk. You have the option to write your script in a Objective-C like style if you want to. And if you're the type of person who is scared of ['s, you don't have to use them!
That's the quick and dirty on JSTalk. The source is up on GitHub under an MIT license, you can download a pre built binary with examples to play with, and it even has a mailing list. It's very much a developer preview, and I really really want feedback on it. I hope to ship a usable 1.0 by WWDC. So if this kind of thing interests you, and you have ideas, please bring it up on the mailing list.
JSTalk source and official README: http://github.com/ccgus/jstalk/tree/master Binary: http://www.flyingmeat.com/download/private/JSTalkPreview.zip Mailing list: http://groups.google.com/group/jstalk-dev