Three Scripting Languages
Creative Suite is somewhat singular in that it supports not one but three scripting languages: AppleScript, JavaScript, and VBScript. Why go to all the trouble when most programs only support one? To its credit, Adobe has done its best to meet the needs of the entire creative community by providing multiple avenues into scripting its programs.
AppleScript
Made by Apple (who else?) and only capable of running on Macs, AppleScript's claim to fame is its similarity to the English language—which should make it easier to learn than other scripting languages. Like all marketing claims, however, this one should be taken with a healthy dose of skepticism. Like English, AppleScript also can be convoluted, offers many ways of saying the same thing, and at times makes absolutely no sense (at least to me).
On the plus side, a wealth of AppleScript learning resources and free scripts for Creative Suite are available. What's more, if a Macintosh graphics program supports scripting, it probably supports AppleScript. Plus, you can use AppleScript to control multiple applications simultaneously; it is a relatively easy scripting language to start learning; and nonprogrammers will find it easier to get the gist of what AppleScript is saying and doing than with the other scripting options.
JavaScript
Hailing from the Web side of the tracks, JavaScript is often used to create dynamic, interactive Web pages—and it was dynamic and interactive long before Flash was born. Although its name suggests a relationship with the Java programming language (and Sun Microsystems licenses both), JavaScript and Java actually have little in common. JavaScript is the only one of the three languages we're looking at that works on both Macs and PCs, and that feature alone makes it very attractive.
In addition to producing great free instructional PDFs for all three scripting languages, Adobe publishes the Creative Suite JavaScript reference in book form. And with Creative Suite 3, Adobe has even included a robust script editor for JavaScript. There are also plenty of free JavaScripts on the Web for Creative Suite, and its relatively strong user base means that you have a built-in support group.
Like Microsoft and its JScript brand of JavaScript, Adobe has implemented its own version of JavaScript, called ExtendScript. It is basically JavaScript that's been "extended" to add a few additional features and it works across the board with all Creative Suite applications.
On the minus side, ExtendScript can only control one application per script (unless you're using the ExtendScript Toolkit; see the sidebar on page 55). JavaScript can be confusing to the nonprogrammer because it may look too "programmy." And most of the JavaScript learning resources you'll find are focused on building Web pages and making interactive forms in Adobe Acrobat. In fact, you'd be hard pressed to find learning resources other than Adobe's on topics other than writing JavaScripts for Web pages or Acrobat. That is a serious limitation at times.
VBScript
If you know the Visual Basic programming language, you'll pick up the Windows-only VBScript easily, because it was derived from Visual Basic. I suspect that most people who script Creative Suite with VBScript either already know it from another context or are Visual Basic programmers. There are practically no VBScript learning resources or free scripts for Creative Suite and, as with JavaScript, you can only control one application at a time with VBScript.
Which Scripting Language Should You Choose?
Here are my guidelines for choosing a Creative Suite scripting language:
- If you spent all of your parents' money on a liberal arts education, you'll probably be most comfortable with AppleScript.
- If you need your scripts to work on both Windows and Mac machines, go with JavaScript.
- If you're familiar with Visual Basic, shake hands with VBScript.
The scripting language you choose will likely depend more on preexisting factors and personal tendencies than any rational criteria. I chose AppleScript because it came free on my Mac, and I was in a culture that supported AppleScript. It was covered in the design magazines I already read, people I knew were dabbling in it, and programs I used to make my living were AppleScript-able. Now that I've been using AppleScript for awhile, I can use it to write Automator actions and full-blown Macintosh applications with AppleScript Studio—but these capabilities are just gravy.
If you are the type who's into rational decisions—and you're starting from scratch—JavaScript is probably the best all-around choice because it's cross-platform; lots of free scripts are available for it; and its strong online culture means that you might be able to get answers to your JavaScript questions at 3 a.m. With JavaScript, you can also program forms in Acrobat and add interactivity to Web pages; plus, you get a nice free JavaScript editor in the box with Creative Suite, called the ExtendScript Toolkit.
I've chosen AppleScript for the simple tutorial later in this chapter because it tends to be easier for newbies to follow, and those familiar with either of the other languages shouldn't have any problem translating.