O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scripting InDesign CS3/4 with JavaScript

Book Description

InDesign provides a powerful set of tools for producing beautiful documents. While you can certainly do all your work by hand through InDesign's graphical interface, there are many times when it's much easier to write a script. Once you've automated a task, you can run it over the whole document, ensuring consistency, or just when you need it, simplifying and speeding your layout process. All it takes is a bit of JavaScript knowledge and a willingness to explore InDesign's programming features.

Table of Contents

  1. Scripting InDesign CS3/4 with JavaScript
    1. Introduction
    2. Hello World!
    3. The ExtendScript Toolkit (ESTK)
      1. Creating a Script In and Running it From the ESTK
    4. InDesign’s Object Model
      1. Parents
      2. Children
        1. Up and down the object model
      3. Three Special Parents
        1. parentStory
        2. parentTextFrame
        3. parentPage
      4. Collections of Objects
        1. everyItem()
      5. Properties
      6. Methods
    5. The Object Model Viewer
    6. JavaScript
      1. Some General Rules
      2. Variables
      3. Reserved Words
      4. Strings
      5. Strings and Numbers
      6. Arrays
      7. Arrays Versus Collections
      8. Operators
        1. Arithmetic operators
        2. Assignment operators
        3. Comparison operators
        4. Logical operators
      9. Statements
        1. if
        2. switch
        3. for
        4. while
        5. with
      10. Functions
      11. Interacting with the User
      12. Unicode Characters
    7. Catching Errors
    8. Running Scripts
    9. Working with Text
      1. Adding, Replacing, and Removing Text
      2. Inserting Special Characters
      3. Styling Text Locally
      4. Styling Text with a Character Style
      5. Styling Text with a Paragraph Style
      6. Paragraph Spacing
    10. Working with Tabs
    11. Some Missing Keyboard Shortcuts
      1. A Keyboard Shortcut for Semibold
      2. Swapping Two Lines/Paragraphs
      3. Indenting a Block of Text
    12. Find and Change
      1. The Basics
      2. Where to Search
      3. Format Settings
      4. Finding Things
      5. A Kerning Editor
      6. Find/Change with GREP
      7. Lower-Casing Acronyms with GREP
    13. Tables
      1. Anatomy of a Table
      2. Getting a Reference to a Table
      3. Snapping Columns
      4. Align on Units
      5. Shading Cells
      6. Processing All Tables in a Document
      7. Applying Table Styles
      8. Find and Change in Tables Only
    14. Text Frames
      1. Script Label/Name
      2. Frame Dimensions
      3. Resizing a Frame
      4. Moving a Frame
      5. Creating a Frame
      6. A Text Frame’s Page Number
    15. Graphics
    16. Captions
    17. Resources
      1. Acknowledgements
    18. About the Author