Your first script
A hands-on, five-step introduction to the paged.* scripting API — read the document, address an element, write a property, author from scratch, and undo — each step runnable in a live editor.
In short in five short steps you'll read a document, change a frame, build one from scratch, and undo it — every step running in a real editor you can edit. By the end you'll know the three moves every script is made of: read, address, write.
1. Read the document
Everything starts with a read. paged.tree() returns the document hierarchy —
as a JSON string, so parse it first. Press Run:
Every read (tree, selection, stories, pages, …) returns a JSON string.
Forgetting JSON.parse is the single most common scripting mistake — "[]".length
is 2, not 0.
2. Address an element
To change something you need its id. The frame in this document is already
selected, so read the selection and turn it into an address — kind:id:
3. Write a property
Now address it and write. paged.set(id, path, value) takes a settable
path and re-renders immediately:
4. Author from scratch
Reads and writes work on what's there — but you can also create. Get a page
id from paged.pages(), make a frame (it returns its new id), and pour text in:
5. Undo
Every write goes through the editor's Operation channel, so paged.undo() reverts
it exactly as ⌘Z would:
Where to go next
- Examplesa working playground for each
paged.*function. - Path showcasesthe 179 settable paths, grouped and runnable.
- Host functionsthe complete API.
- Constraintsthe sandbox rules and budgets.
Scripting with paged.*
The Boa-based scripting layer — a sandboxed ECMAScript surface for reading and authoring a paged document through the paged.* host API. The full surface is generated from the engine catalog.
Examples
A working, editable playground for each paged.* host function — read the document, style frames, author text, apply styles, place images, and undo, each runnable against the real editor.