JavaScript in Cocoa tutorial

I just finished a short tutorial on using JavaScript from Cocoa apps. It is really quite a nice and easy way to script things if you are using ObjC.http://will.thimbleby.net/script/

It is quite short and hopefully will help if you are thinking of adding scripting to your apps. The example application is a very small but fun turtle drawing app scripted in JavaScript. Here's a quick screenshot of what the app does, using JavaScript to control the turtle to draw fractal trees.

There's also py-objc and RubyCocoa that allow you to write "real" Cocoa code and transparently access object in the different languages. That means that there is pretty much no limits on what you can do in the "scripting" language.

But sometimes, especially for games, you want limits on what you can do. The JavaScript bridge makes it very easy to set these limits where you want to, and that IMO is actually one of the attractions to it as a scripting language.