v0.145.4Internal beta docs

Beta documentation · eXLib v0.145.4. Public release is pending.

Creating Variables

There are three ways to turn a literal in your code into a reusable {{name}} variable, plus a fourth path through the pickwhip that captures a property reference in the same motion you'd use to insert one in the first place.

Tokenize a selection

Select a literal — a number, boolean, quoted string, bare word, or a layer/property reference chain — right-click, and choose eXLib: Tokenize Selection. The selection becomes {{name}}, a matching variable is declared with a name inferred from what you selected, the Variables panel opens, and a toast confirms. Already-tokenized text or an empty selection is rejected, with an explanation of why.

Auto-detect

Choose eXLib: Auto-detect Tokens (right-click, or the DETECT button in the Variables panel) and eXLib parses the whole expression with a real parser, then proposes a reviewable checklist of candidates. Scoring order:

  1. Declared variables (highest)
  2. Named object properties
  3. Meaningful magnitudes

Detect filters out noise — array indices, trivial 0/1/-1, and values that are already tokenized — and it recognizes whole reference chains, like thisComp.layer("Ctrl").transform.position, as one variable rather than several fragments. Each candidate shows its reason. Nothing changes until you accept it, and accepting the whole set is one undoable step.

i

These screenshots were captured in an earlier beta. Toolbar and Library layouts have since changed; the written instructions on this page describe v0.145.4. See A Tour of the Panel for the current controls.

The Detect proposal checklist with several checked candidates, each showing its reason
Detect proposes; you accept. Every candidate states why it was suggested, and nothing changes until you say so.

Where a captured reference lands

A tokenized number, boolean, or color starts wired to a new control shaped for what it looks like — a plain number becomes a Slider, [x, y] a Point, and so on.

A tokenized property or layer reference starts wired to a new control of the type that reference resolves to — 1D to a Slider, 2D to a Point, 3D to a 3D Point, a color to a Color control, a layer reference to a Layer control — never back to the property it replaced. The captured reference survives only as that control's default value: there so re-wiring the variable to a live link, or detokenizing it, both stay exact, but never itself the live target. A variable wired straight back to the exact reference it replaced would still evaluate exactly as that reference did — tokenizing it would have changed nothing.

A reference whose type can't be resolved, or that resolves to text, lands on Ask on apply instead — there's no control a text value could become.

This is the same rule whether the reference reached the panel through Tokenize Selection or through Auto-detect's checklist. A reference scoped to one specific layer — thisComp.layer("Ctrl").transform.position — has a second delivery option beyond a plain new control; see Wiring the Bay.

Add one by hand

Click + Add variable to declare one without touching the code first. It lands as Ask on apply — no target wired, nothing substituted — until you wire it to a control or a property. Its type chip reads TBD with a neutral question glyph until something in the expression says what it is; that's the ordinary state for a fresh variable, not a warning, and picking a control kind for it doesn't change it.

From the pickwhip

Insert a property reference with ⌃⌘R (Alt-click for the relative form), select the inserted text, then Tokenize it — or run Detect. It resolves the same way any captured reference does — wired to a new control of the matching type, with the inserted reference kept as that control's default — reusable like any other variable.

Renaming and removing

Renaming a variable (blur or Enter) re-uniques it against the session and rewrites every {{oldName}} in the code to {{newName}}, as one atomic undo step — a single ⌃⌘Z reverts both the panel and the code together. Name collisions resolve automatically: variable, variable2, variable3.

Removing a variable (the trash icon) inlines its original value back over every {{name}} occurrence in the code, as one undoable step — so a removed variable never leaves an orphaned placeholder behind.

✓

Variable and control edits share one 100-entry undo history, ⌃⌘Z / ⌃⇧⌘Z. These fire only while the Variables panel is open and focus is outside a text field. Rapid edits to the same field within 600 ms coalesce into one undo step, and editor-text side effects — tokenize, rename, Detect insertions — are chained in, so one ⌃⌘Z reverts the whole action, code and panel together.