X
Tech

Is AppleScript under siege?

In a survey, Adobe asks its developers about scripting support in Creative Suite. But it sure looks as if coders are being asked to choose between AppleScript and something else.
Written by David Morgenstern, Contributor

In a survey, Adobe asks its developers about scripting support in Creative Suite. But it sure looks as if coders are being asked to choose between AppleScript and something else.

A note posted Friday in Jeff Tranberry's Photoshop Crawlspace (he's the QE product lead for Photoshop) asked Adobe developers to "help us understand how you use ExtendScript, JavaScript, ActionScript, AppleScript, VBScript and other scripting languages with Photoshop and the Adobe Creative Suite." It pointed to a survey hosted by Developer Evangelist Mark Niemann-Ross.

The survey offers the following choices for each of the scripting languages:

• Critical to my work • This language is nice to have, but I could do without it if I have to • This language isn't important to me • I've never used this language and probably never will • No answer

It then asks how the scripts are used: whether sold to end-users, developed in-house, offered as a value-add by an integrator, or written on a contract basis for a customer.

Now, there's an "Other" field. If they were asked, this might be the place that would be filled in by the many thousands of individual Mac users who take advantage of AppleEvents scripting to automate their workflows. But these folks aren't the target demographic.

It's easy to read between the lines here: if we're counting the votes from professional scripters, and considering a product that supports multiple platforms, which is made at a company that is pitching its own framework, AppleScript may be running out of luck.

There have been other recent threads taking shots at AppleScript in the community. Around the time of WWDC, Daniel Jalkut on his Red Sweater blog wrote that Apple should make JavaScript its default scripting language.

There, I said it. It wasn’t easy, because I hold a soft spot in my heart for AppleScript. But I’m slightly more of a pragmatist than a romantic. If JavaScript is what Apple cares most about, and JavaScript is where massive performance improvements are going to be made, then Apple should leverage those improvements to the benefit of every desktop scripter.

It sounds like I just said “Apple should kill AppleScript,” but I didn’t. You see, the Open Scripting Architecture, on which AppleScript runs, is designed from the start to support multiple languages. Think of the “Open Scripting” part of the system as the part that lets a script tell another application to do something. The specific scripting language you use to accomplish the rest is really of no concern whatsoever. Two languages, such as JavaScript and AppleScript, can easily live side by side.

(Also recall that at WWDC, the Webkit team announced that it had moved to the speedy SquirrelFish intepreter. The team said that based on the SunSpider JavaScript benchmark, SquirrelFish is 1.6 times faster than WebKit’s previous interpreter. So, JavaScript on Safari now works better and faster.)

Comments to his suggestion appeared to fall into two camps: those who hate AppleScript, and those programmers who started out with AppleScript and graduated to other languages (or still stick with it).

I appreciated the thoughtful response from some of the latter camp.

For example, Kevin Walzer said that professional programmers underestimate how user-friendly it can be for beginners. He was responding to post that said that while AppleScript code can be easy to read, it wasn't easy to actually code.

After years of more powerful languages likeTcl and Python, of course, my own perspective on AppleScript has changed to a degree; its quirks are more annoying, and I still have to refer to Matt’s book on occasion. I just got hung up writing an AppleScript that accessed a single-item list, and it took me forever to translate “theList[0]” into AppleScript’s “item 1 of theList”.

He said that AppleScript was still part of his toolbox. "It is the quickest way to access certain resources in OS X. ... Apple has enabled AppleScript to fit in comfortably with other scripting languages."

Charles Arthur also said that novice programmers would be intimidated by JavaScript code.

What doesn’t happen enough is that people aren’t encouraged enough to think “why am I doing the same task again and again when this computer could do it?” We don’t encourage people to find ways around that. Automator is a good step towards making people not do things manually. Applescript is the next level down. But with Javascript (to reverse the metaphor) the learning curve is wayyyy steep.

Yes, Applescript can be infuriating. But I learnt through wanting to learn, writing tiny scripts, reading the series by Bill Briggs at Maccentral - now, it seems, Not Wanted On Voyage. (And Apple hasn’t helped with its stupid AS implementations in OSX.) The first script I did let me find out how much spare space I had on my drives. Now I do scripts that parse XML, parse just about anything. I’ve tried Javascript (and I can do PHP, so I’m not totally lame) but I really don’t see the “ease” thing.

Yes, programmers - who make their living as programmers - may not like AS, and may prefer JS. But that’s not who AS is aimed at; and the latter group is much, much bigger and could benefit *so* much more from even a little automation in their lives. Making them do Olympic high jumps just to get over a low fence doesn’t seem right.

Still, programmer Bob Warwick wasn't buying it. He said that Automator should now be the scripting solution for novices.

Since the introduction of Automator, I think that argument loses all water. That’s the real scripting language for never-programmers on the Mac.

I don’t know if JavaScript is the way to go, but I agree that AppleScripts niche has already had something better for that type of user move in.

There are serious workflows in large companies based on AppleScript. But its longterm usefulness may be in question. Or not. What do you think? Are you a scriptor or an AppleScriptor?

Editorial standards