Learning in public — this documentation is written in the open and updated as the engine moves.
paged.Paged Docs
Scripting (paged.*)

Host functions

Every paged.* host function available to scripts, grouped by kind — generated directly from the engine's scripting catalog.

Tier: ProProIIIreference

In short The complete paged.* host surface, grouped by what each function does. Generated from the engine catalog — if the engine adds a function, it appears here automatically.

179 of 179 host functions, grouped by kind.

Read

FunctionReturnsSummary
paged.get(address, path)value JSON | nullRead one property of any addressed object, as its wire value JSON (the read twin of paged.set; RequestGet on the wire). Text is read with path "text" (read-only): a story answers its paragraphs joined by \n, a text frame its story's (the whole thread), a storyRange its characters. A plugin: address asks the host's object registry: a Promise of the value's JSON (null when absent or mixed); a refusal rejects with .code. Try it ▸
paged.inspect(id)ElementProperties JSONFull property snapshot for one element (or storyRange), or for a story (story:<id>: its text, then its story rows); null when the address names nothing. Try it ▸
paged.tree()SceneTreeNode[] JSONDocument hierarchy: spreads → pages → frames. Try it ▸
paged.pages()PageSummary[] JSONPages with selfId + 1-based index + sizePt. selfId is the page id for insertFrame/insertTextFrame/insertPage (and the afterPageId of insertPage) — the only way a script can obtain a usable page id. Try it ▸
paged.stories()StorySummary[] JSONLoaded stories with selfId + characterCount + paragraphCount. The source of valid story ids. Try it ▸
paged.layers()LayerSummary[] JSONDocument layers. Try it ▸
paged.query(selector)string[] JSONCanonical addresses of every object a selector matches, document order (ADR 131): `page:#3 > frame`, `frame[name="price"]`, `[label.x-paged:oid=a1b2]`, `textFrame[style=Price]` (a style matches a page item's object style and, on a text frame or story, the paragraph and character styles its story applies), unions with `,`. Throws SyntaxError (with the offset) on a malformed selector. A selector naming plugin: kinds or objects is evaluated by the host's object registry and returns a Promise of the same JSON.
paged.schema(addressOrKind)PropertySchema[] JSONThe typed property schema rows (ADR 132) of an address's kind (frame:u1, swatch:Color/Red) or a kind name (frame, page). A plugin: address or kind asks the host's object registry: a Promise of its PropertySchema[] JSON.
paged.commands(owner?)Promise<CommandInfo[] JSON>The typed commands the host's object registry offers (core's first), optionally of one owner ("core" or a plugin id): a Promise of the CommandInfo[] JSON. With no host it throws code noHost.
paged.address(id)string|nullCanonical address of an object, from any accepted spelling (`frame:u1`, `page:#2`, a style by name) or a {kind,id} element; null when nothing answers to it.
paged.swatches()SwatchSummary[] JSONColour palette (selfId/name/kind). Try it ▸
paged.paragraphStyles()ParagraphStyleSummary[] JSONParagraph styles — the source of valid styleRefs for applyStyle. Try it ▸
paged.characterStyles()CharacterStyleSummary[] JSONCharacter styles. Try it ▸
paged.objectStyles()ObjectStyleSummary[] JSONObject styles. Try it ▸
paged.gradients()GradientSummary[] JSONGradients. Try it ▸
paged.colorGroups()ColorGroupSummary[] JSONColour groups. Try it ▸
paged.links()LinkSummary[] JSONPlaced-asset links. Try it ▸
paged.conditions()ConditionSummary[] JSONConditional-text conditions. Try it ▸
paged.conditionSets()ConditionSetSummary[] JSONCondition sets. Try it ▸
paged.collection(name)Summary[] JSONGeneric typed-collection read by name; unknown name → "[]" + warning. Try it ▸
paged.documentMeta()DocumentMeta JSONDocument metadata (name/creator/modified/page count). Try it ▸
paged.selection()ElementId[] JSONCurrent element selection. Try it ▸
paged.contentSelection()ContentSelection JSON | nullCurrent text caret / range. Try it ▸
paged.planarRegions([id, ...], [x, y]?)PlanarRegionsResult JSONThe planar arrangement of the named paths: found, faces (each with an id), inputCount, complete, reason. With a point, only the face under it. This is how a script names a face for pathfinderFaces.

Write

FunctionReturnsSummary
paged.set(address, path, value)boolSet one property of any object (Mutation::Set). address is an idGrammar address — an element (rectangle:u12, storyRange:Story/u1@0..6), doc, page:#2, layer:<id>, swatch:Color/Red, style:object/<id>, cell:<table>/0,1, textVariable:<id>, … — and path any row propertySchemas lists for that kind (settablePaths on elements). The value is coerced by the path's schema (enum members, ranges, "3mm" on a length). null clears. A selector is not a target: paged.query it first. The protocol-70 target object ({kind:"layer",layerId}) is still accepted, deprecated. A plugin:<pluginId>/<kind>/<id> address goes to the host's object registry (ADR 323): it returns a Promise<true>, consecutive plugin sets fold into ONE batched host round trip, a refusal rejects with an Error whose .code is the registry's code (an unawaited refusal fails the script), and core + plugin writes of one script undo as one step. With no host registry it throws code noHost. Try it ▸
paged.invoke(id, args?)Promise<command result JSON>Run a typed command — core.<op> (every catalog operation, args as the op's typed struct; id positions take addresses) or a plugin's — through the host's object registry (RequestHostObjects invoke): a Promise of its result JSON ({ created, undoSteps } for a core command). Commands live in the host's registry only: with no host it throws code noHost; a refusal rejects with .code. Inside paged.batch use { op: "invoke", id, args, handle? }.
paged.resizePage(pageId, [t,l,b,r])boolSet a page's GeometricBounds in page-inner points. Try it ▸
paged.applyMasterToPage(pageId, masterId?)boolApply a master to a page (omit/null detaches). Try it ▸
paged.movePage(pageId, afterPageId?)boolMove a page to follow another (omit/null: to the front).
paged.renameMaster(masterId, name?)boolSet (omit/null: clear) a master's name.
paged.onMaster(masterId, mutation)boolApply a mutation ({ op, args }) to a master spread's items.
paged.setPageMetadata(pageId, key, value?)boolSet or delete one plugin-metadata entry on a page (value: the JSON envelope).
paged.moveFrame(frameId, [a,b,c,d,tx,ty])boolSet a frame's affine placement transform. Try it ▸
paged.resizeFrame(frameId, [t,l,b,r])boolSet a frame's content-box bounds (re-paginating resize). Try it ▸
paged.pathPointCurveType(elemId, index, smooth)boolToggle an anchor between corner and smooth. Try it ▸
paged.pathPointSet(elemId, index, role, [x,y])boolWrite one Bezier handle (role = anchor|left|right). Try it ▸
paged.pathOpenAt(elemId, index)boolCut the path at the anchor at flat index. Try it ▸
paged.outlineStroke(elemId, width, cap, join, miter)boolReplace the path with its stroke-expansion outline. Try it ▸
paged.offsetPath(elemId, delta, join, miter)boolInset (delta<0) / outset (delta>0) a single closed contour. Try it ▸
paged.simplifyPath(elemId, tolerance)boolRe-express the path with fewer anchors within tolerance pt. Try it ▸
paged.setFieldValue(storyId, offset, value?)boolUpdate a placeholder field's cached display value (null ⇒ unresolved). Try it ▸
paged.replaceImageBytes(frameId, bytes?)boolCommit inline image bytes (number[] of u8) on a graphic frame; null clears. Try it ▸
paged.setRowHeight(storyId, tableId, row, height?)boolSet/clear a table row height in pt. Try it ▸
paged.setColumnWidth(storyId, tableId, col, width?)boolSet/clear a table column width in pt. Try it ▸
paged.setCellSpan(storyId, tableId, row, col, rowSpan, columnSpan)boolSet a cell's row/column span. Try it ▸
paged.renameParagraphStyle(styleId, name)boolRename a paragraph style. Try it ▸
paged.renameCharacterStyle(styleId, name)boolRename a character style. Try it ▸
paged.renameObjectStyle(styleId, name)boolRename an object style. Try it ▸
paged.renameCellStyle(styleId, name)boolRename a cell style. Try it ▸
paged.renameTableStyle(styleId, name)boolRename a table style. Try it ▸
paged.setStyleProperty(collection, styleId, path, value)boolSet one property on a style definition (collection = paragraph|character|object|cell|table; path = a settablePaths name). Try it ▸
paged.editNumberingList(listId, spec)boolEdit a <NumberingList>. Try it ▸
paged.editSection(sectionId, {prefix?,style?,start?})boolEdit a <Section>; prefix/start are tri-state (omit ⇒ leave, null ⇒ clear). Try it ▸
paged.setConditionVisible(conditionId, visible)boolFlip a condition's visibility. Try it ▸
paged.setFlowGrowRule(storyId, grow, maxPages?, copyFrameOptions?)boolLet a story's frame chain grow: generated pages are added after its last frame's page while it oversets (InDesign's Smart Text Reflow), and removed when empty. copyFrameOptions gives generated frames the chain's frame options (a Word section's mode) instead of InDesign's defaults. grow=false clears the rule.
paged.activateConditionSet(setId)boolActivate one <ConditionSet> ("show only this set"). Try it ▸
paged.layerMove(layerId, newIndex)boolReorder a layer to a new zero-based index. Try it ▸
paged.moveGuide(guideId, position)boolMove a guide along its perpendicular axis. Try it ▸
paged.setDocumentDefaults({fill?,stroke?,weight?})boolSet the new-object fill/stroke/weight defaults (whole-triple). Try it ▸
paged.setColorSettings({cmykProfileName?,rgbPolicy?,intent?,bpc?})boolReplace the document colour-management settings. Try it ▸
paged.setProofSetup({profileName?,simulatePaperWhite?,intent?})boolSoft-proofing configuration (profileName null turns proofing off). Try it ▸
paged.setInkSetting(spotId, {convertToProcess?,aliasTo?})boolReplace one ink's output-time settings. Try it ▸
paged.setUseStandardLabForSpots(enabled)boolPrefer spots' Lab primary over their CMYK alternate in previews. Try it ▸
paged.setPluginMetadata(elemId, key, value?, caller?)boolWrite one Label key/value pair on a leaf page item (value null deletes). Try it ▸
paged.setDocumentMetadata(key, value?, caller?)boolWrite one document-scoped Label key/value pair (value null deletes); undoable.
paged.setElementSelection([id, ...])boolReplace the element selection with the parseable ids. Try it ▸
paged.clearSelection()boolClear the element selection. Try it ▸
paged.setContentSelection({storyId,start,end} | null)boolSet or clear the text caret/range. Try it ▸
paged.layerSetVisible(layerId, visible)boolShow or hide a layer.
paged.layerSetLocked(layerId, locked)boolLock or unlock a layer.
paged.layerSetPrintable(layerId, printable)boolInclude a layer in output, or hold it back.
paged.layerSetName(layerId, name)boolRename a layer.

Author (structural)

FunctionReturnsSummary
paged.insertText(storyId, offset, text)boolInsert plain text at a story body offset; \n splits paragraphs. Try it ▸
paged.deleteRange(storyId, start, end)boolDelete the [start, end) character range of a story. Try it ▸
paged.insertTextFrame(pageId, [t,l,b,r])string (created id) | nullCreate an empty text-pourable frame at page-local point bounds (mints a story) and select it. Returns the new textFrame:<id> address, or null on failure. Try it ▸
paged.insertFrame(pageId, [t,l,b,r])string (created id) | nullCreate an empty graphic (non-text) frame and select it; the usual placeImage target. Returns the new frame's kind:id address, or null. Try it ▸
paged.insertPage(afterPageId?)string (page selfId) | nullAppend a page after afterPageId (or at the end), inheriting the default master. Returns the new page's selfId (reusable as the next afterPageId), or null. Try it ▸
paged.placeImage(frameId, uri, fit?)boolPlace an image into a frame; fit is an optional fitting mode. Try it ▸
paged.applyStyle(storyId, start, end, styleRef)boolApply a paragraph/character style to a story range. Scope inferred from the ref prefix (CharacterStyle/… else Paragraph). Try it ▸
paged.createGroup([id, ...])boolGroup two-or-more elements; <2 valid members returns false. Try it ▸
paged.duplicateElements([id, ...], dx, dy)string[] (created ids) JSON | nullDuplicate page items: a whole clone of each (properties, plugin metadata, group members, pasted-in children, a text frame's story), offset by (dx, dy) pt and inserted directly above its source, in one undo step. Selects the clones and returns their kind:id addresses in source order; null when the engine refuses (threaded text frame, anchored object, opacity mask, an element named together with its group).
paged.deletePage(pageId)boolDelete a page. Try it ▸
paged.duplicatePage(pageId)string | nullDuplicate a single-page spread after the source — its items, a copy of each frame's story, its margins; returns the new page selfId. Try it ▸
paged.createMaster(masterId, { name?, widthPt?, heightPt?, duplicateOf? })boolCreate a master spread: one page of the given size, or a copy of another master.
paged.deleteMaster(masterId)boolDelete a master no page applies.
paged.deleteElement(id)boolDelete a page item (kind:id address or bare self id). Try it ▸
paged.dissolveGroup(groupId)boolUngroup; members return to the group's paint slot. Try it ▸
paged.linkFrames(fromId, toId)boolThread fromId's overflow into the empty frame toId. Try it ▸
paged.unlinkFrames(frameId)boolBreak the text thread leaving a frame. Try it ▸
paged.insertLine(pageId, [x1,y1], [x2,y2])string | nullInsert a two-anchor open GraphicLine. Try it ▸
paged.insertOval(pageId, [t,l,b,r])string | nullInsert an Oval. Try it ▸
paged.insertPath(pageId, anchors, open, smooth?)string | nullInsert an arbitrary path; anchors = [{anchor:[x,y],left:[x,y],right:[x,y]}, …]. Try it ▸
paged.pathPointInsert(elemId, index, anchor, subpathStarts?)boolInsert an anchor into a path's flat PathPointArray at index. Try it ▸
paged.pathPointRemove(elemId, index)boolRemove the anchor at flat index. Try it ▸
paged.pathfinderBoolean(keptId, [otherIds], kind)boolPathfinder boolean (kind = union|intersect|subtract|exclude). Try it ▸
paged.insertField(storyId, offset, fieldKind)boolInsert a field marker; fieldKind = "pageNumber" | "nextPageNumber" | { placeholder: { plugin, key, value? } } | { textVariable: { variableId } } (an instance of a text variable; InDesign keeps it). Try it ▸
paged.createTextVariable(name, contents?, textBefore?, textAfter?)string (address) | nullDefine a custom text variable; returns textVariable:dTextVariablen<name>. Switch its value with paged.set(address, "textVariableContents", v) — every instance re-bakes.
paged.deleteTextVariable(variableId)boolRemove a text variable definition (refused while an instance is in the text).
paged.insertTable(storyId, spec)string | nullCreate a <Table> at the end of a story; spec = { rows, cols, headerRows?, footerRows?, columnWidths?, rowHeights? }. Returns the table id. Try it ▸
paged.insertTableRow(storyId, tableId, at)boolInsert an empty body row at index. Try it ▸
paged.deleteTable(storyId, tableId)boolDelete a whole table and its host paragraph; undo restores every cell.
paged.deleteTableRow(storyId, tableId, at)boolDelete the body row at index. Try it ▸
paged.insertTableColumn(storyId, tableId, at)boolInsert an empty column at index. Try it ▸
paged.deleteTableColumn(storyId, tableId, at)boolDelete the column at index. Try it ▸
paged.insertHeaderRow(storyId, tableId)boolInsert a header-band row. Try it ▸
paged.removeHeaderRow(storyId, tableId)boolRemove the first header row. Try it ▸
paged.insertFooterRow(storyId, tableId)boolInsert a footer-band row. Try it ▸
paged.removeFooterRow(storyId, tableId)boolRemove the last footer row. Try it ▸
paged.createParagraphStyle({id?,name?,basedOn?})string | nullCreate a paragraph style; returns its selfId. Try it ▸
paged.deleteParagraphStyle(styleId)boolDelete a paragraph style. Try it ▸
paged.createCharacterStyle({id?,name?,basedOn?})string | nullCreate a character style; returns its selfId. Try it ▸
paged.deleteCharacterStyle(styleId)boolDelete a character style. Try it ▸
paged.createObjectStyle({id?,name?,basedOn?})string | nullCreate an object style; returns its selfId. Try it ▸
paged.deleteObjectStyle(styleId)boolDelete an object style. Try it ▸
paged.createCellStyle({id?,name?,basedOn?})string | nullCreate a cell style; returns its selfId. Try it ▸
paged.deleteCellStyle(styleId)boolDelete a cell style. Try it ▸
paged.createTableStyle({id?,name?,basedOn?})string | nullCreate a table style; returns its selfId. Try it ▸
paged.deleteTableStyle(styleId)boolDelete a table style. Try it ▸
paged.createNumberingList(spec)string | nullCreate a <NumberingList>; returns its id. Try it ▸
paged.deleteNumberingList(listId)boolDelete a <NumberingList>. Try it ▸
paged.insertSection(pageId, {prefix?,style?,start?})boolAnchor a <Section> at a page. Try it ▸
paged.deleteSection(sectionId)boolDelete a <Section>. Try it ▸
paged.layerInsert(position, name)boolAppend a layer at the zero-based stacking index. Try it ▸
paged.layerRemove(layerId)boolRemove a layer. Try it ▸
paged.insertGuide(spreadId, orientation, position, pageIndex?)boolInsert a ruler guide (orientation = vertical|horizontal). Try it ▸
paged.deleteGuide(guideId)boolDelete a guide. Try it ▸
paged.importSwatchLibrary(bytes, groupName?)boolImport an .ase swatch library (bytes = number[]) as one undoable op. Try it ▸
paged.batch([mutations] | [objectOps])bool | per-op results JSONApply an array of { op, args } mutation objects as ONE undoable step (bool). An array of ADR 323 object ops ({ op: "set", address, path, value }) returns the per-op results JSON ([{ ok } | { ok: false, code, reason }]), all-or-nothing in ONE undo step; when any op names a plugin: address, or is a typed command ({ op: "invoke", id, args, handle? }), the whole batch goes to the host's object registry (a Promise of the same JSON), so a command shares the one undo step with the sets. Try it ▸
paged.reorderElement(id, target)boolRaise or lower an element in its parent's z-order. target = front | back | forward | backward | {index: n} (n = the final slot, 0 = backmost).
paged.pasteInto(containerId, childId)boolNest an existing item inside a container frame.
paged.releaseFrom(childId)boolLift a nested item back out of its container (inverse of pasteInto).
paged.closePath(id, subpath?)boolClose an open contour; subpath defaults to the whole path.
paged.joinPaths(id, otherId)boolWeld two open paths into one.
paged.pathfinderDivide([id, ...])boolDivide the selection into its planar regions.
paged.pathfinderTrim([id, ...])boolTrim hidden parts of the lower shapes away.
paged.pathfinderMerge([id, ...])boolMerge adjacent same-paint regions of the selection.
paged.pathfinderCrop([id, ...])boolCrop the selection to the topmost shape.
paged.pathfinderOutline([id, ...])boolReduce the selection to its outlined edges.
paged.pathfinderMinusBack([id, ...])boolSubtract the shapes behind from the frontmost one.
paged.pathfinderFaces([id, ...], [faceId, ...], mode)boolBuild ONE element from faces of the planar arrangement, united: mode keep = the named faces, remove = every other face (none named: every face, so the inputs unite). The result goes onto the topmost input covering a selected face; every other input is removed, so faces outside the selection are not kept. Face ids come from paged.planarRegions.
paged.applyOpacityMask(targetId, maskId, {maskType?, invert?}?)boolMask one element with another.
paged.releaseOpacityMask(targetId)boolRemove an element's opacity mask.
paged.attachTextToPath(id, storyId, {pathTypeAlignment?, flipPathEffect?, startBracket?, endBracket?}?)boolRun a story along a path.
paged.detachTextFromPath(id)boolTake a story back off its path.
paged.insertAnchoredFrame(storyId, offset, width, height, imageUri?)boolAnchor a frame in the text at a story offset; with imageUri the frame is created holding that image.
paged.insertHyperlink(storyId, start, end, url, pageId?)boolMake a character range a clickable link. Read the result with paged.collection("hyperlinks") — paged.links() is the placed-asset list, not this.
paged.deleteHyperlink(hyperlinkId)boolDelete a hyperlink (any origin) by its id from paged.collection("hyperlinks"): its text stops linking, and its URL or page destination goes when nothing else uses it.
paged.editHyperlink(hyperlinkId, { name?, url?, pageId? })boolRename a hyperlink or send it to a new URL or page (pageId wins); an empty name clears it.
paged.updateTableOfContents(storyId)boolUpdate Table of Contents: rewrite a TOC story (one bound to a TOC style) from its style over the current layout — the title, then one paragraph per heading with its page number. Until then it prints the text it holds.
paged.generateIndex(storyId)boolGenerate Index: write the document's index into a story (replacing its text) from its topics and page references over the current layout — the title, a heading per letter, each topic with its pages and See references. Index styles the document lacks are created.
paged.updateCrossReferences(sourceId?)boolUpdate Cross-References: rewrite a cross-reference's text (every one's without an id) from its format and its destination paragraph; the page number is always live.
paged.insertFootnote(storyId, offset, text)string|nullInsert a footnote at a story offset: its reference there, and the note (its number, the separator, then text). Returns the note's id; read the notes with paged.collection("footnotes").
paged.deleteFootnote(storyId, footnoteId)boolDelete a footnote: its reference and its note. Undo puts both back as they were.
paged.insertNote(storyId, offset, text, user?, date?)string|nullInsert an editorial note at a story offset: its place there (one character that prints nothing) and its text, paragraphs separated by \r; user and date are what it records as its author and dates. Returns the note's id; read the notes with paged.collection("notes").
paged.editNote(noteId, text, date?)boolRewrite an editorial note's text; date becomes its modification date.
paged.deleteNote(noteId)boolDelete an editorial note and its place in the text. Undo puts it back as it was.
paged.convertNoteToText(noteId)boolConvert to Text: an editorial note's place becomes a space and the note's text, its paragraphs the story's.
paged.createBookmark(name, {page?, destination?, parent?, index?})string|nullNew Bookmark: to a page (through a page destination of its own) or an existing destination, under a bookmark or at the top level, at an index among its siblings. Returns the bookmark's id; read them with paged.collection("bookmarks").
paged.deleteBookmark(bookmarkId)boolDelete a bookmark and the bookmarks under it, and the page destinations nothing else goes to. Undo puts them back.
paged.renameBookmark(bookmarkId, name)boolRename a bookmark.
paged.insertEndnote(storyId, offset, text)string|nullInsert an endnote at a story offset: its reference there and its range in the endnote story, after the note before it, as InDesign writes one. The first endnote makes the endnote story on a page of its own. Returns the endnote's id; read them with paged.collection("endnotes").
paged.deleteEndnote(endnoteId)boolDelete an endnote: its reference and its range. Undo puts both back as they were.
paged.convertFootnoteToEndnote(storyId, footnoteId)string|nullConvert a footnote to an endnote: the footnote goes and an endnote of its text takes its reference's place. Returns the endnote's id.
paged.moveBookmark(bookmarkId, parentId?, index?)boolMove a bookmark with the bookmarks under it: under another bookmark (the top level for null), at an index among its siblings.
paged.createSwatch(spec)string (created id) | nullCreate a swatch from a SwatchSpec ({space, value: [...], name?, model?, tint?}); returns its selfId.
paged.editSwatch(swatchId, spec)boolReplace a swatch's definition.
paged.deleteSwatch(swatchId)boolDelete a swatch.
paged.createGradient(spec)string (created id) | nullCreate a gradient from a GradientSpec ({kind: "Linear"|"Radial", stops: [...], name?}); returns its selfId.
paged.editGradient(gradientId, spec)boolReplace a gradient's definition.
paged.deleteGradient(gradientId)boolDelete a gradient.
paged.createColorGroup(spec)string (created id) | nullCreate a colour group from a ColorGroupSpec; returns its selfId.
paged.editColorGroup(groupId, spec)boolReplace a colour group's definition.
paged.deleteColorGroup(groupId)boolDelete a colour group.

History (undo/redo)

FunctionReturnsSummary
paged.undo()boolUndo the last mutation. Try it ▸
paged.redo()boolRedo the last undone mutation. Try it ▸

Console

FunctionReturnsSummary
console.log(...)undefinedAppend a line to the captured output log.
console.warn(...)undefinedAppend a warn-level line to the captured output log.
console.error(...)undefinedAppend an error-level line to the captured output log.
console.info(...)undefinedAppend an info-level line to the captured output log.