Scripting Support For Links

ecLink Class

From 2022, an ecLink class has been added to the scripting module to enhance the scriptability in the creation, inspection and modification of links. This represents an EasyCatalog link, either text or frame based. An ecLinks collection exists on most InDesign layout objects.

Basic Properties

A link is described using 3 basic properties:

  • ecDatasource – The name of a data source.
  • ecFieldName  – The name of a field.
  • ecKey – Record key field value.

Additional Properties

Additional properties control the behaviour of the link and store internal data:

  • ecComputedCommand – The Computed Field command.
  • ecParentField – The parent Field object if available, or null.
  • ecLinkType – Type of link:
  • ecContentType – Content type of the link:
  • ecLinkStatus – Status of the link:
  • ecParentField – The parent Field object if available, or null.


  • add – Add a new Link to a Collection.
  • find  – Find links matching the given properties.
  • findRecords  – Find records belonging to links matching the given properties.

ecLink Collections

The collection is added to most InDesign basic types. The example below illustrates use of ecLinks within a document and selection, but this can equally applies to spreads, pages, pageItems:

Optimizing Access

When using collections, InDesign rebuilds the collection each time a member of the collection is accessed. Using a static array is almost always faster than using collections. So rather than:

Use the more efficient form, which scans the document once:


The Scripts Panel menu has an option called “Install EasyCatalog Sample Scripts”, which copies some useful example scripts into your Scripts Folder.

Creating A link

Removing all links of the first page

Removing all instances of the seleted field

Replacing Fields