label(itemOrLabel, label)

Tags a page item with a given script label in the InDesign Script Label panel (Window -> Utilities -> Script Label). If only one argument is given, label() returns the first item that is tagged with the given label. Use this instead of labels(), when you know you just have one thing with that label and don’t want to deal with a single-element array.

Type: function

Parameter(s):

  • itemOrLabel {String | PageItem}:

    The page item to tag or the label identifier to search for.

  • label {String}:

    The label identifier to tag the page item with.

Returns:

  • {PageItem}:

    The tagged page item or the first page item with the given label.