on apple scripting languages and pain

I really want to like AppleScript. It’s a weird programming language, and I like weird programming languages, ergo, I should like AppleScript. In theory, there’s a ton of stuff you CAN do with applescript to do automated stuff on the mac.

But it seems like every time I delve into Applescript I rapidly descend into complete madness, ending up hours later phrasing and rephrasing the same line trying to get it to do something trivially simple in any other language and screaming at the computer in fury. It is not a language for humans to program in. It is a gross deceptive horror of a language. It makes no sense. You read AppleScript and you think, OK, it’s like english, and you try to write it and no, its not like english at all. It is a happy fluffy pink bunny hiding a jar of acid behind its back. I hate this *@&#(@&*# language.

I got to thinking about AppleScript today because over on Daring Fireball John Gruber has a long post about deep problems he’s been having with AppleScript, with a digression in the middle about the horrors of AppleScript in general. It’s a post that made me grimace in pain and sympathy, and wonder throughout “oh no. no it can’t be that bad.” but yes. It was. His bug is, fortunately, not a bug I have run into. I have not done that much with AppleScript, and frankly, I would have given up way before he did. But it is a bug that makes me throw up my hands in disgust at the sheer….inelegance of it all.

It is really shameful that Apple, which does so well in its consumer-facing hardware and software visual and industrial design, has such an ugly, nasty, slimy, drooling troll of a language design for its underlying automation. That’s just WRONG. And its wrong that Apple has gone so long — what, fifteen years?! without fixing it. It’s like an old rotten blankie they just can’t stop worrying. Just throw out the damn language, Apple. Just start over with something that works.

It is good that Tiger has Automator, to help user automation, so now normal humans don’t have to deal with AppleScript. That’s a start. But I’m surprised as I poke around that if you want to program Automator, to do more than just click the buttons, you have two choices: AppleScript (arrrggghhh) and Objective C. The nasty unlearnable scripting language and the heavyweight scary Real Programming Language. Not the most approachable framework.

On the other hand Dashboard uses JavaScript as its scripting language. Someone in that group didn’t drink the koolaid, I guess. JavaScript isn’t exactly the most perfect programming language, but at least it makes some marginal amount of logical sense.

OSX does have the Open Scripting Architecture, OSA, which theoretically enables other scripting languages to be plugged in and used instead of AppleScript for basic automation. I haven’t heard much about this other than that there are plug-ins for JavaScript and Python. I get the impression that its not commonly used. I should add that to my list of Stuff to Play With (only about 40 items long now….)

5 thoughts on “on apple scripting languages and pain

  1. AppleScript isn’t so bad. It’s just different and takes getting used to. And like other things, it helps if you learn a bit about it first. Matt Neuberg’s book’s a good start. So’s Danny Goodman’s update to his classic AppleScript tome. There’s a few others too. And plenty of support available in Apple’s AppleScript Users mailing list.

    Actually Dashboard doesn’t just use Javascript. This is just what it uses in its presentation layer. It can also use AppleScript, the Cocoa APIs and shell scripting of any variety in combination with the HTML/CSS/Javascript presentation layer.

  2. See, it’s not just me

    Quote of the day, from limon, by Laura Lemay, on apple scripting languages and pain: But it seems like every time I delve into Applescript I rapidly descend into complete madness, ending up hours later phrasing and rephrasing the same…

  3. AppleScript’s learning curve is about like any other programming language. It’s just that everybody expects learning AppleScript to be easier than it is because it looks so much like English.

Comments are closed.