InDesign User Group

Chicago InDesign User Group

Meeting Notes Archive

Wednesday, March 16, 2005
Digital Bootcamp
Mike Carruth, Host

Scripting in InDesign® CS

Presenters:

  • Rich McCormick-Carroll
    Applications Specialist, Capps Digital
    Chicago, IL

  • Rick Johnson
    Illustration Supervisor, Kalmbach Publishing Co.
    Waukesha, WI

  • Ed Joras
    Principal, Technology Consultant, Graphtech Systems, LLC
    Deerfield, IL

This truly was one of the most meaty meetings we’ve had in a long time. There was a certain evangelism in the air that reminded me of the early days of DTP. The room was pretty packed, and most there had had some exposure to scripting, the evening’s topic, and all appeared to be avid listeners soaking up everything the speakers had to offer. Top that off with excellent speakers, all, and you have the ingredients for one fine meeting.

Rich McCormick-Carroll from Capps Digital started the evening off with a bang, offering a wide perspective on how to get into scripting, tips and tricks and resources to pursue — starting with Apple.com/AppleScript. Rich says, “Give it a try, it’s not so daunting.” In fact, AppleScript is a lot like English, and it’s a great language to use to add extra capability to InDesign without a whole lot of work. It’s not cross-platform but it’s easier than all the rest for getting started — well, at least your starter scripts can be really easy. How do you know what’s scriptable? Typically anything you can do with menu or key commands or assigning attributes. The hardest things are often those actions that require a mouse.

Start with an achievable goal — start small and build up one step at a time. Start with a lot of free stuff you can get on the web — including lots of PDFs on the Apple site — and names of people you can contact. Check out Adobe’s “User-to-User Forums” at http://www.adobeforums.com — the one called “Scripting Adobe Applications.” There’s also Adobe Studio Exchange at http://share.studio.adobe.com. There you can find all kinds of useful scripts that are free or available for a small fee. Rich, for example, found a JavaScript to export each InDesign page in a file as a PDF.

Other great resources are MacScripter.net, with its related site ScriptBuilders.net, which is a growing archive of AppleScripts. And also Scripting Matters, Inc., “AppleScript Automation and Development Training” — this site is largely the work of Ray Robertson, a one-man Mac shop that does a lot of AppleScripting plus a few more technologies, automating workflows for prepress and publishing. Rich also highly recommended Danny Goodman’s book AppleScript Primer, which is now an eBook. This book has become a classic first reference for scripting novices on up. Note that the eBook contains just updates — best to get a hold of the real thing. Rich also said that O’Reilly Publishing has a new book out on AppleScript. Also check out the Apple Consultants Network, which has resources specifically for Apple, including some very famous guys in the scripting world — Shane Stanley in Australia, who has a five-day AppleScript training. TecSoft.com also does AppleScript training. And, of course, for scripting for InDesign, check out the 1,735-page sample scripting guide that’s available on the InDesign user group site.


Scripting Matters
Visit their website.
http://scriptingmatters.com/

But aside from all these helpers, Rich encourages you to “beg, borrow, and steal.” Find something close to what you need to do and then modify it. For instance, he showed us how he took a script that takes lots of pictures that have been placed in a folder and automatically puts them onto an InDesign page with the correct filename below each shot. But Rich wanted that script to work on a different-size paper. Other examples of great uses for scripts involve anything that is repetitive and time-consuming — again, making PDFs from 100 docs. Josh Samos pointed out that you have to balance that benefit with the two days it takes to develop the script. Obviously, you have to love doing this kind of thing; otherwise you won’t last very long!

Tim King from J. Walter Thompson mentioned that rather than starting to play around with someone else’s script, it’s better to set yourself the task of writing a script for something you really need or that really inspires you. Tim also suggested PremediaSystems.com. They have a lot of experience writing custom software and automation tools for the publishing industry, using AppleScript and other languages. Very oriented to Mac. Another recommendation is Script Debugger, a $150 - $200 application that can show you what’s scriptable and help you clean out the bugs.

BTW, for any scripts that you build or find for InDesign, put them in InDesign’s Preset folder in the b folder. It's a good idea to have the .scpt extension on the file name. Then in InDesign, locate those scripts from the window menu and select > Scripting > Scripts (>AppleScript and >JavaScript). Double-click a script in the palette to execute it. Tim also mentioned easily obtainable scripts that check the color space in images and that sample images down.

Rich found an ImageCatalog script that counts the number of graphics in a folder and puts them on an InDesign page and scales them. He also did a script with nine pictures on a page, fitting images proportionally and then shrinking the frame to match the image size. One of the best things he said about AppleScript is that it’s unique in allowing tasks to move across applications. More on that point with Ed Joras’ presentation.

Rick Johnson from Kalmbach Publishing Company showed some neat scripts in a lot of detail. Rick is a full-time employee of Kalmbach. They publish 14 magazines and a line of books, which they are now migrating from Quark to InDesign. He dazzled us with his brilliance as he showed in two minutes how the layout of a recent issue of his magazine was automated from front to back cover. Wow, Watch all those stories and pictures just jump into place on the layout. What a show! Oops, turns out it was just wishful thinking, a mocked-up scenario for the future, but he sure had everyone fooled there, thinking, “Wow, and you can do this with a script?” Animating a series of screen shots (done in Adobe Acrobat®) can sure look great! Too bad scripting isn’t quite that far just yet!

Rick then got serious and showed us a script he built to export InDesign stories to InCopy®. Getting stories ready for editors from the InDesign layout is no fun. And there’s a special challenge to not include stories that don’t need editing — dumb stuff like folios and master page footers, etc. — which is what you get when you use the Export All Stories command in InDesign (when the InCopy plug-in for InDesign is installed). The script does two things. The main thing is that it exports all the stories that need editing. This means you have to do some legwork, labeling text frames you don’t want exported with the “folio” or “no export” tags using the Scripts Label palette, grouped with the Scripts palette. This is best done on the master pages to save work later on. Better still, tag the frames in your template document and you may never have to tag a frame again. The script also checks at the start for whether the InDesign file was saved. So make sure, before running the script, that you save the file and it’s still open — reason being that the filename is used as the basis for the exported InCopy filenames. Also, the location of the InDesign file determines the location of the folder in which the InCopy files are saved. After exporting only the stories needing editing, it tells you the number of stories exported. You can get a copy of his script on the Adobe Studio Exchange from the Graffix website.


Graffix
Download scripts for both InDesign and Illustrator® from their website.
http://rj-graffix.com/
software/scripts.html#InDesignScripts

At the above link, you’ll also find Rick’s second script, “Scatter Proof,” which he based on a number of available scripts that you can easily find in the sources Rich mentioned. Basically, it’s a proof sheet with pictures of all shots that the art directors can review. It’s actually a variation of what Rich had shown. This script first asks the user to choose from a list of template documents that the user created, which can be as many and as varied as desired. The script then prompts the user for a folder containing the image files to print, populates the graphic frames in the doc with the image files, and scales and rotates them to fit the frames, adding the filenames in corresponding text frames. This script requires an opened template file with frames in place on the page. This script could be customized to display much more information about the files, such as the file size, image type, resolution, color space, and color profile.

His third script, called “Make All Printable,” starts by opening a Quark .qxd file which some images won’t print as a result of converting the file to InDesign. All that’s required is setting the “nonprinting” property of all rectangles and ovals to “false,” and presto the whole thing prints!

Last, but certainly not least, Ed Joras was a reward for those who stayed after the break. Worth the wait. He started by saying that he teaches scripting and is willing to get calls on scripting. Now there’s an offer! He said that comparing scripting for Quark and scripting for InDesign, XPress was extremely scriptable but nevertheless “inscrutable” — impenetrable. Main difference between scripting for those two? — Objects, where in Quark, your job was a lot more challenging because all object identities are dependent on a cascading series of things, starting with the document identity and then the page, the picture box, the text box, the story, and the words. The programmer must reference that order each time an object is named. Not true in InDesign, in which each object has an absolute ID number, which allows you to generate unique number object references and deal with a lot less formal hierarchy. However, in InDesign the properties of objects are much more complicated. Examples of InDesign objects are books, document settings, colors, images, links, and layouts. He said that your first script can easily take four days to develop, but that you get better the more you do. He stressed the importance of asking yourself first whether you really need a script. If you’re coming from Quark, some of what you anticipate needing to script in InDesign is no longer necessary. It’s built in.

Ed also emphasized that you should write a script in manageable chunks, so it’s easy to test. When you know that what you have works, you can add the next small step, test it until it works again, and then add on another bit, and so on. Get it working before adding. Ask for help on the lists and bulletin boards — programmers are generally very helpful. Hot tip — use comments liberally to explain to yourself the methodology you used to construct the script. Then when you need to update it (yes, unfortunately, scripts need to be updated like other software), the comments remind you of what the heck you did! Ed wrote a script in 1998 that he’s had to upgrade four times since then.

Ed also showed us the structure of an AppleScript, with the green text being the variables that are defined at the top of the script and the blue text being the conditional statements. AppleScript is especially great now in OS X because it runs so much faster. Lack of speed in OS 9 and earlier was a major drawback. Not with X. And it’s a lot easier now because not only can you move between applications, but you can also do things that involve the operating system, the Finder. For example, Ed wrote a script to export a file from InDesign to PDF. Then, start an email in MacMail and make the PDF an attachment (warning — scripting in MacMail is a “nightmare”).

Well, it was clear we could have gone on and on, but the raffle prizes were waiting. And they were so plentiful that Tom and Clint had to gang them into “packages” so that it wouldn’t take the rest of the night to find a winner for each one. Whether you won a prize or not, everyone left the meeting invigorated and ready to go jump on the scripting game, buoyed by all the tips and tricks and all the resources and encouragement these three guys gave up in bounteous supply. Many thanks for a truly inspired meeting!!

—Yours truly, Eda Warren
Adobe Certified Training Provider and
Adobe Certified Expert on InDesign CS
http://www.go-training.com





Meeting Notes Archive
View notes from past meetings of the Chicago InDesign user group.
Read notes from other meetings!


Meeting Topics Archive
With user group chapters across the United States, Europe, and Australia, we have gathered quite a bit of information from presenters, Adobe representatives, attendees, and industry experts during the past four years.
Read all of the notes

Copyright © 2008 Adobe Systems Incorporated. All rights reserved.

Online Privacy Policy  •   Terms of Use