Adobe InDesign

Adobe InDesign

Adobe InDesign can be a really great application to script. The object model is logical and robust, and Adobe has done a great job supporting multiple scripting formats equally (though I wish I could say the same about Acrobat). I have written a lot of scripts that I just wouldn’t be able to accomplish with QuarkXPress and that, ultimately, is what led my company to make the switch over to InDesign as the default layout application.

At the same time, there are some aspects of InDesign’s API that can be a real barrier to anyone learning how to script for InDesign for the first time, beginners and advanced developers inclusive. The snippets included on the linked pages are not only those that allow me to build a framework for complex scripts, but also help define clear paths to complex operations or what should be no-brainers but that Adobe needlessly (or at least non-obviously) muddled. I’ve written about this a few times on an old blog and as this site gets developed, I’ll be bringing those posts over in the hopes that I can save someone else the agony of figuring out how to do a simple rotation.

A Few Notes About Versions

As far as I’m concerned, CS2 was the perfect balance between Applescript-savvy syntax and a logical object model and anything afterwards was just a waste of time. Instead of simply building on what Adobe already had, CS3 began a sometimes mind-boggling transformation to turn the syntax and function calls into something more familiar to programmers (i.e.,veterans of application development yet new to scripting). CS4 cleans up this transformation quite a bit, but still leaves me wanting CS2’s implementation with having CS4’s complexity. I can understand why they did this, but I’ve always felt that both could be had and fault Adobe for falling well short of Applescript’s goals.

For the given snippets, I try to note which version of the Creative Suite the snippet was written for if there isn’t a tell statement in the code. But this is a “best guess” most of the time, and in a lot of cases code is largely interchangeable between CS2 and CS3. The common change that can bite you is a command’s syntax was changed from…

tell anObject to performAnAction

…to the function-centric…

tell anObject
	set theResult to performAnAction
end tell

… and beyond that, it’s down to the individual commands but that’s few and far between. In CS4, the syntax was simply made more uniform across all commands, and I have found that the task upgrading code from CS2 to CS4 is almost entirely changing the commands to receive results.

I’ve only just upgraded to CS5 and I have yet to see how things have changed. Once I have some scripts updated, I will add anything noteworthy.

Please feel free to contact me at any time to let me know of errors, improvement, and any comments on how to improve the site.