Thursday, March 26, 2009 [Tweets] [Favorites]

Introducing JSTalk

Gus Mueller:

You write your scripts in JavaScript, and application communication is handled via Cocoa’s distributed objects. Like PyObjc and RubyCocoa, JSTalk uses a bridge to talk to Cocoa (JSCocoa + WebKit’s JavaScriptCore), so you get all the power and speed that comes with it. JSTalk comes with a little editor, a command line tool, and an automator action. If an application you want to script isn’t exposed via JSTalk, you can still tell it what to do via the Cocoa Script Bridge (which is new to 10.5).

First of all, this is very cool. However, I think defining the object model, e.g. using XML, is a feature. Otherwise there’s no separation between the scripting interface and the application’s unstable internal interfaces. Secondly, most of my scripts need to run on other Macs, which don’t have anything special installed. Hopefully, Apple will take a look at JSTalk along with Appscript and JavaScript OSA, come up with something modern and cool, and build it into the OS.

3 Comments

Actually, you can have a separation between the internal interfaces, and what you give out, via proxy objects. It's a bit more work, and I need to write up a sample... but I'm pretty sure it can happen.

But yea, it's a bit of a chicken and egg problem. Why support it when nobody else does? (Which is why it'll also work via the scripting bridge).

I didn't write it up, but you can also save a script as a runnable application, which includes everything you need (framework + script), so it'll run on another mac without anything special installed.

[...] Tsai makes some smart observations about JSKit, also agreeing that it’s cool, but taking exception to Gus’s claim that [...]

Gus: Yes, you can get the separation if you make the effort. But I think in practice that’s unlikely to happen because DO sort of exposes everything by default, whereas AppleScript hides everything by default. In a way this is a strength of DO, as it makes it very powerful, but on the other hand I think sdef is actually pretty good for defining interfaces and also documenting them for AppleScript’s dictionary viewer.

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment