Learning in public — this reference is being written in the open. Unfinished pages are excluded from search engines.
paged.IDML Reference
Scripting (paged.*)

Sandbox & budgets

The execution model for paged.* scripts — a pure ECMAScript sandbox with no I/O, plus the runtime budgets that keep scripts safe — generated from the engine catalog.

Tier: ProProIIIreference

In short scripts run in a pure ECMAScript sandbox — no network, no filesystem, no timers, only paged.* and console.*. The rules below come straight from the engine catalog.

  • Scripts run in Boa (pure ECMAScript), NOT Node: no require/import, fetch, fs, setTimeout, or network. Use only paged.* and console.*.
  • Reads return JSON STRINGS, not live values: JSON.parse(paged.selection()/tree()/stories()/pages()/…) before you index. Parsed elements are { kind, id } objects — address one as the string `${kind}:${id}` (e.g. textFrame:u3) for paged.set / inspect / get.
  • Property writes (paged.set) return a boolean: true = applied, false = rejected (unknown id/path, bad value, or a failed precondition). The structural insert fns are the exception — see below. Always check the result and adapt.
  • Writes go through the editor's Operation channel, so paged.undo()/paged.redo() work exactly as in the UI.
  • Runtime budgets: ~10M loop iterations, recursion depth 512, and a ~2s wall-clock checked at every host call. Runaway scripts are aborted (non-catchable).
  • insertFrame/insertTextFrame return the new element's kind:id address (and auto-select it); insertPage returns the new page's selfId. Pass the returned id straight to paged.set / placeImage / insertText (use paged.pages() for a page id, paged.stories() for the minted story).
  • Bounds are page-local points in [top, left, bottom, right] order. The document works in points (1/72 inch).