Run ExtendScript
illustrator_run_scriptExecute custom ExtendScript in Adobe Illustrator for tasks not covered by specialized tools. Use return to send JSON data back.
Instructions
Execute arbitrary ExtendScript (Illustrator's JavaScript) in the active Illustrator instance. Use this for anything the specialized tools do not cover — advanced paths, effects, batch edits, reading detailed properties, etc.
The code runs inside a function body: use return <value> to send JSON-serializable data back. The global app and the active document are available, plus helpers: __doc(), __color(hex), __setPos(item, x, y), __itemInfo(item), __abRect(), __activeAB(doc), __style(item, opts).
Coordinates in Illustrator's native API are Y-up and global; the helpers convert to artboard-relative Y-down.
Example code: var d = __doc(); var r = d.pathItems.rectangle(0, 0, 100, 100); return __itemInfo(r);
NOTE: This can modify or delete artwork and interact with the file system. Prefer the specialized tools when they fit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ExtendScript source to run. Use `return <value>;` to return JSON-serializable data. |