Learn about how to automate common tasks using the Scripts panel and the Script Label panel in InDesign.

Scripting in InDesign

Scripting is a great tool for performing a variety of tasks. A script can be as simple as an automated common task or as complex as an entire new feature. You can create your own scripts, and you can run scripts that other people have created. For more information on scripting, see the Scripting Guide, scripting requirements, and other developer resources at http://www.adobe.com/devnet/indesign/documentation.html.

The Scripting Guide contains an introduction to scripting and tutorials. You can also find a number of useful scripts that you can run, such as a script that draws guides around the selected object. Some of these scripts appear by default in the Scripts panel.

Scripts panel and Script Label panel overview

InDesign includes two panels for scripting: the Scripts panel and the Script Label panel.

The Scripts panel is where you run scripts without leaving InDesign. The Scripts panel displays the scripts that are located in the Scripts folders in the InDesign application folder and in your Preferences folders. If you create or receive a script, you can place it in the Scripts Panel folder so that it shows up in the Scripts panel.

Mac OS

Users/[username]/Library/Preferences/Adobe InDesign/[version]/[language]/Scripts/Scripts Panel

Windows XP

Documents and Settings\[username]\Application Data\Adobe\InDesign\[version]\[language]\Scripts\Scripts Panel

Windows Vista and Windows 7

Users\[username]\AppData\Roaming\Adobe\InDesign\[version]\[language]\Scripts\Scripts Panel

Poznámka:

A quick way to locate the Scripts Panel folder is to right-click (Windows) or Control-click (Mac OS) a script in the Scripts panel, and choose Reveal In Explorer (Windows) or Reveal In Finder (Mac OS).

You can then double-click a script in the Scripts panel to run it, or you can run scripts using Quick Apply.

The Script Label panel lets you specify a label for a page item, such as a text frame or shape. Specifying labels for page items is especially useful for writing scripts in which you need to identify an object.

Poznámka:

For detailed information on adding, running, and editing scripts, see the Scripting Guide on the Adobe website at http://www.adobe.com/devnet/indesign/documentation.html.

Open the Scripts panel

  1. Choose Window > Utilities > Scripts.

Open the Script Label panel

  1. Choose Window > Utilities > Script Label.

Sample scripts

AddGuides

Adds guides around the selected object or objects.

AddPoints

Adds points to the paths of the selected object or objects.

AdjustLayout

Moves objects by specified distances on right/left pages.

AlignToPage

Aligns objects to specified positions on a page.

AnimationEncyclopedia

Automatically creates buttons with different animation properties.

BreakFrame

Removes a selected text frame and its contents from a story.

CornerEffects

Re-draws the path of the selected item or items using a variety of corner effects. Corner effects can be applied to selected points on the path.

CreateCharacterStyles

Defines a complete character style based on the selected text.

CropMarks

Adds crop and/or registration marks around the selected object or objects.

ExportAllStories

Exports all stories in a document to a series of text files.

FindChangeByList

Performs a series of common text find/change operations by reading a tab-delimited text file.

ImageCatalog

Places all graphics in a specified folder in a “contact sheet” layout.

MakeGrid

Creates a grid by subdividing or duplicating the selected object or objects.

Neon

Applies a “blend” effect to the selected object or objects.

PathEffects

Changes the position of path points on the selected object or objects to add a creative effect.

PlaceMultipagePDF

Places all pages of a PDF.

SelectObjects

Selects objects on the active spread by their object type.

SortParagraphs

Sorts the paragraphs in the selection alphabetically.

SplitStory

Splits the text frames in the selected story into separate, unlinked text frames.

TabUtilities

Applies tab stops and indents to the selected text.

For more information on installing and using these sample scripts, see www.adobe.com/go/learn_id_scripting_readme_cs5_en (PDF).

Community-contributed scripts

InDesign also provides more scripts that are created by the InDesign community. These scripts are displayed in the Scripts panel under the Community section.

Script Name Description Prerequisites
Script developer
InsertTypographerQuote

Adds quotation marks before and after the text selection. 

By default, multiple versions of the script are available. You can configure these scripts for other languages based on your requirement:

  • French, German, Swiss, and English quotation marks.
  • Single quotation marks for indirect speech.
Select a text to run this script.
Stefan Rakete
Clear Overrides Override can be cleared using this script for paragragh, character, table, and object styles. This script will reset any overriden style attribute. For fine tuning, you can limit the process to objects, tables or text formatted with a particular style.

Open at least one document to run this script.
Gregor Fellenz
UnicodeInjector
This script inserts a sequence of one or more Unicode characters at the current insertion point in InDesign.

  1. Make a copy of the UnicodeInjector.jsx file. 
  2. Look up the Unicode characters you desire to insert (e.g. assume we want to insert a hair space, U+200A).
  3. Rename the copy so it contains the desired unicode(s) as well as some descriptive text - e.g.  U+200A Insert a hair space.jsx.
  4. Move the 'U+200A Insert a hair space.jsx' script to your InDesign Scripts folder. 
  5. Go to InDesign - the script is ready for use. Position your text cursor by double-clicking in any text frame, then double-click the script name on the Scripts Palette; the unicode character(s) will be inserted
To run this script:
  1. Place the text cursor in the text frame, without selecting the text.
  2. Rename the script to configure it. To view configuration instructions, right-click the script and choose Edit Script.
Kris Coppieters
Snap Margins to Text Frame

Sets InDesign document margins visually and intuitively, instead of making you perform complex mathematical calculations.

Margins are adjusted to match the selected text frame throughout the active document.

Ensure to:

  • Select a text frame to run the script.
  • Select a non-rotated text frame.
  • Select a text frame on the right-hand page to apply the mirror margin.
Ariel Walden
Break Text Thread
Breaks the thread:
  • Between the selected text frame and the next. 
    Select a text frame and run. The thread will be broken after the selected frame.
  • Before all text frames in the document that contains a specific paragraph style.
    Select some text and run. The thread will be broken before all frames containing the paragraph style under the cursor.

You can choose the following options to break text thread: 

  • Before the selected frame
  • After the selected frame
  • All frames in the selected story
  • Before frames with the selected paragraph style. 

 

Ensure that the selected text frame is not the last frame.

It is useful when you need to break a long document into separate chapters.

Ariel Walden

Licencia na používanie tohto diela sa poskytuje v súlade s podmienkami licencie Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Na príspevky v sociálnych sieťach Twitter™ a Facebook sa nevzťahujú podmienky licencií Creative Commons.

Právne upozornenia   |   Zásady ochrany osobných údajov online