Tuesday, April 24, 2007

 

CS3 is Here!

The new scripting features in CS3 are both awesome and somewhat intimidating. All the new features of InDesign CS3 are supported and there are new scripting-specific enhancements that most non-scripting users will never notice. The most immediate issue faced by anybody who has accumulated a collection of scripts is compatibility -- will the existing scripts still run?

The answer is mostly.

First, there's the versioning feature. Put your CS2 scripts in a folder named Version 4.0 Scripts and they'll run as though the application is still InDesign CS2. Although there are some subtle changes that might affect some scripts. For example, CS2 always delivered the members of the selection (when more than one item was selected) in a reliable order. CS3 does not, even with versioning switched on. Frankly, I would never have known that had it not been for Pete Kahrel who has written some CS2 scripts that took advantage of that ordering. So far, among my own scripts, I've yet to discover one that won't work with versioning on, except for those scripts that explicitly check the application's version (which returns 5.0.0.nnn, where nnn is the build number) even with versioning on.

What about converting scripts. How many need converting? Quite a few.

Any script that uses Find/Change of text is going to have to be revised to use the new structure. This part of InDesign's scripting system is tightly bound to the user interface feature and even a cursory glance at the new Find/Change dialog tells you that a lot has happened here.

Any script that depends on the Story.textFrames collection to manage the text frames (and paths) that constitute a story will instead need to work with the textContainers property, which (unfortunately) is not a collection but an array. Story.textFrames is still a collection, but now it is the collection of inline/anchored text frames inside a story. FWIW, I've already written one script that was able to take great advantage of this:
//DESCRIPTION: Fix overset anchored text frames

if (app.documents.length == 0) { exit() }
app.documents[0].stories.everyItem().textFrames.everyItem().fit(FitOptions.frameToContent);
This script came in very handy for eliminating the overset condition of all my anchored figure/caption text frames when I increased the space between the figures and their captions by changing the space before of the caption paragraph style.

Scripts that transform objects have a whole new way of working that I have yet to investigate.

Scripts that interact with paragraph, character and object styles now have to deal with grouping of styles. This is more a philosophical issue than a technical one. The chances are that existing scripts will still run, but they might not do what the user really wanted if he has organized his styles into group hierarchies.

What's New?

First and foremost for JavaScripters, ExtendScript Toolkit 2 is introduced. It represents a major facelift over its predecessor and it includes object model viewers (OMV) accessed through the Help menu that eliminate the need for those horrendously large reference PDFs. Indeed, InDesign CS3's scripting documentation consists of a Guide and Tutorials (one for each scripting language) with the reference available only through the OMV.

Support is added for Script UI, the scriptable interface system that was previously available with Bridge.

Scripts can now interact with and add items to the menu system and they can respond to certain system events. Indeed, if you explore the product you'll discover that the File/CrossMedia Export features have been added by scripts.

JavaScripts can now be saved as binary files.

I have the distinct impression that I'm selling the new features short here, but "real work" beckons, so I'll be back with more when time allows.

This page is powered by Blogger. Isn't yours?