Tag Archives: applescript

The nature and purpose of AppleScript

An amusing sentence from the first chapter of *[AppleScript The Definitive Guide][oreilly]* by Matt Neuberg:

> To find reasons to use AppleScript, just leave your mental annoyance meter turned on.

But don’t forget to switch off your brain once you do start using AppleScript; the frustration of getting anything done with the miserable Macintosh applications that expose their workings via AppleScript never fails to kick my mental annoyance meter into the red.

The following paragraph employs sarcasm. I’ve just being having a wonderful time figuring out that [Adobe InDesign CS3][adobe] keeps the list of items on a page sorted by layer, but sorted in reverse layer order and then sorted forward within each layer. This makes it super sweet when you want to determine if box A in layer 1 overlaps box B in layer 2. Thanks Adobe! Another genius implementation from you guys! You guys fucking rock!

And it isn’t just the fault of the applications you want to script, the language itself is intentionally imprecise in trying to allow programs to be written in natural language. “Whether this English-likeness is a good thing is debateable,” writes Matt Neuberg, but he is being polite because if there is any debate on this question it is a fucking short debate: AppleScript’s English-likeness only serves to have you make mistakes with more confidence.

There is an interesting [history of AppleScript][history] which tantalizes the present-day scripter with the revelation that the language authors wrote a syntax “which resembled Java” but never released it, preferring to support scripts written in fucking French and fucking Japanese!

[oreilly]: http://oreilly.com/catalog/9780596102111/
[history]: http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf
[adobe]: http://www.adobe.com/products/indesign/