MANUAL / SCRIPTING & EXPRESSIONS

ScriptUI panels and dialogs

Build dockable panels and dialogs for your scripts with After Effects' ScriptUI.

What it does

A script's ScriptUI opens as a Brio panel you can dock. The script's top-level this is a Panel (as for a script in AE's ScriptUI Panels folder), so the usual pattern docks:

var w = (this instanceof Panel) ? this : new Window("palette", "Title");
var b = w.add("button", undefined, "Add Null");
b.onClick = function () { app.project.activeItem.layers.addNull(); };
if (w instanceof Window) w.show();

A new Window("palette") that is show()n opens as a panel too.

  • Each button click or edit runs its handler as one run, on the comp open at that moment, as one undo step.
  • The panel stays until it's closed — by its tab, or win.close(). Closing the tab ends the script.

Building

  • container.add(type, bounds, text, properties).
  • Resource strings: w.add("group { orientation: 'row', ok: Button { text: 'OK' } }"), new Window("palette { … }"). Named children become properties (w.grp.ok).

Containers and layout

ItemNotes
group, panel, tabbedpanel / tabContainers.
orientationrow / column / stack
alignChildren, alignment, spacing, margins
preferredSize (or size / bounds)Sets the size. Pixel positions in bounds are ignored.
charactersOn text fields.

Controls

ControlNotes
statictext
edittextmultiline, readonly, noecho
button
iconbuttonShows its text.
checkbox
radiobuttonSiblings are exclusive.
slider / scrollbarvalue, minvalue, maxvalue
dropdownlist / listboxitems, add("item", text), selection, removeAll(), find(text); listbox multiselect
progressbar

Common members: text, value, enabled, visible, helpTip, name, properties, parent, children, remove(), removeAll(), layout.layout() (no-op), show(), hide(), close(), center().

Events

EventWhen
onClickClicked.
onChangeField left or Enter pressed, slider released, list item picked.
onChangingAs you type or drag.
onDoubleClickListbox.
onShow, onClose

Also addEventListener("click", fn) and notify().

Dialogs

new Window("dialog") + show() returns 1 (OK) or 2 (Cancel), as in AE. A button named or labelled ok / cancel closes it without a handler; close(n) returns n.

Brio shows the dialog and then runs the script again from the top with the answers filled in, so code before show() runs twice — keep it free of side effects.

Limits

  • image and graphics (custom drawing, fonts, colours) are accepted and ignored.
  • ScriptUI.environment.keyboardState reads all keys up.