Put yourself in the driver's seat
A full ExtendScript code editor lives inside the panel. Use it to refine AI output, debug broken scripts, or write from scratch with the AI looking over your shoulder.
What it is
The Script Editor is a button next to the three mode tabs (Question / Expression / Script) at the top of the panel. Click the </> icon and the chat view swaps for a full-height code editor with the chat docked alongside.
Everything that ships in a real editor ships here: ExtendScript autocomplete for the entire AE API, multi-cursor editing, search and replace, bracket matching, a beautifier, and a save flow that drops your work either into the Toolbar or your AE Scripts folder.
When to use it
1. Drive the AI instead of being driven by it
The chat tabs ship a finished response. The Script Editor lets you treat AI output as a draft: open it, refine specific lines, ask follow-ups against the actual code in the buffer, and re-run as you go.
- Generate a script in Script mode. Hit the Copy button on the response, switch to the Script Editor via the
</>button, and paste the code in. Both views stay mounted, so the chat is still right there while you work. - Select any block in the editor. A small menu surfaces above the selection with three actions:
- Ask — fire a question about the selected code without leaving the editor.
- Edit — request a rewrite. The diff lands inline with an Accept / Revert preview; nothing changes until you accept it.
- Explain — plain-English walkthrough in the chat pane.
- Every AI-edited region gets a blue dot in the gutter. Multiple pending edits stack. Use the Accept Edits button to clear all pending markers in one shot, or click any dot to re-open that edit's preview and Accept or Revert it individually.
2. Debug a broken script
If a script you already have throws errors or behaves wrong, paste it into the editor and let the AI read it in place. Two patterns work well:
- Highlight + Ask the failing line or block. The AI sees just that slice plus the surrounding code as context, and answers directly in chat.
- Run, observe, iterate. Hit Run to execute the buffer against your AE project. Errors come back in the output panel; click any error to jump the cursor to the line. Ask follow-ups without losing the code.
- this throws 'expression error: undefined is not an object', what's the issue?
- the script runs but the layer names don't change — what's wrong?
The editor uses your AE selection the same way chat does — load it into the context with + Load selection so the AI knows which layer or property the script is meant to operate on.
3. Write from scratch with autocomplete
Type app., comp., or layer. and the editor pops a dropdown with every matching member of the AE API. The info panel beside the dropdown shows the signature and the JSDoc straight from the Adobe typings, so you do not need to alt-tab to the After Effects Scripting Guide.
comp.,layer.,prop.,item.,layers.,project.,selectedLayers.,key.are pre-resolved to their AE types, so you can chain off them without writing avar X = …upstream first.- Inheritance is flattened in the dropdown.
comp.shows Item + AVItem + CompItem members all together, exactly like real ExtendScript resolution at runtime. - Light type inference: if you write
var c = app.project.activeItem;, thenc.on the next line knowscis a CompItem.
Tour of the surface
Selection menu
Drag-select any chunk of code. A small bar with Ask · Edit · Explain floats just above the selection.
- what does this loop actually do, step by step?
- is `comp.layers[0]` reliable or should I use something else?
- why might this throw on a precomp?
- use forEach instead of a for-loop
- wrap this in an undo group named 'Stagger Layers'
- make it run on every selected comp, not just the active one
- add a 30fps fallback for the frame rate
- explain this expression line by line
- what's the gotcha with `setValueAtTime` here?
Inline AI Edit preview
Every Edit request lands as an inline diff above the changed lines:
- The original line(s) blur out, the proposed replacement fades in.
- A blue dot appears in the gutter on every line the AI touched.
- The preview floats Revert and Accept buttons. Esc or a click outside the diff closes the preview without changing anything.
- Accept commits the diff and removes the dots. Revert restores the original line(s) exactly. There is no "partial accept" — each edit is atomic.
Quick Run pad
Next to the Script Editor button sits a small Play icon — that's Quick Run. It opens a scratchpad: paste any .jsx snippet, hit Run, see the output below. Save-As on the pad promotes a throwaway into a saved Toolbar script if it turns out to be a keeper.
Quick Run executes with wrap: false, so scripts that manage their own app.beginUndoGroup work correctly without Sidekick double-wrapping the undo stack.
Beautify
Ctrl + Shift + F formats your code. With a selection it formats only the selection; otherwise it formats the whole buffer. Smart quotes get normalized to straight quotes, and ExtendScript #target and #strict pragmas at the top are protected before the formatter runs.
Multi-cursor and search
- Ctrl-D — add the next occurrence of the current word to your selection
- Ctrl-Alt-↑/↓ — add a cursor on the line above or below
- Ctrl-Shift-L — select every match of the current word in the buffer
- Ctrl-F — open search; press again or hit Ctrl-Alt-F for find-and-replace (F3 / Shift-F3 also work)
Clicking any identifier softly highlights every other reference to that name in the buffer — handy for tracing a variable without running a full search.
Save and Run
The button row above the editor surface has:
- Save — write the buffer back to the linked file on disk. If no file is linked yet, this falls through to Save as….
- Save as… — opens a native save dialog. Pick any destination and filename — your AE Scripts folder for a
File > Scripts > Run Script File…workflow, your project folder, anywhere. Subsequent Saves write back to the chosen path without re-asking. - Format — beautify (same as Ctrl + Shift + F).
- Chat — toggle the chat pane in or out of view.
- ▸ Run — execute the buffer against your project right now.
wrap: false, same as Quick Run, so scripts that manage their ownapp.beginUndoGroupwork correctly.
To pin a buffer as a one-click Toolbar button, save the matching .jsx via Save as…, then add it from the Toolbar with + New scriptlet. Or generate the script in Script mode in chat and click Save to Toolbar on the response — that path short-circuits the editor entirely.
Keyboard reference
| Action | Shortcut |
|---|---|
| Trigger autocomplete | . or any identifier prefix |
| Beautify (selection or whole buffer) | Ctrl + Shift + F |
| Find | Ctrl + F (or F3) |
| Find and replace | Ctrl + Alt + F (or Shift + F3) |
| Next occurrence cursor | Ctrl + D |
| Add cursor above / below | Ctrl + Alt + ↑ / ↓ |
| Select all matches | Ctrl + Shift + L |
| Close AI Edit preview | Esc, or click outside the preview |
Common workflows
Refine an AI script, then ship it
- In Script mode, prompt for what you want. Hit Send.
- Copy the code from the response. Click the
</>button to open the Script Editor and paste it in. - Select a chunk that's wrong → Edit → describe the fix → Accept the diff.
- Hit Run to test it against AE. Repeat the select-edit-run loop until happy.
- Save as… when done. Save to your AE Scripts folder for File > Scripts execution, or save the
.jsxanywhere and add it to the Toolbar from the Toolbar's + New scriptlet button for one-click reuse.
Debug someone else's broken script
- Open the Script Editor. Paste the broken
.jsxinto the buffer. - Load any relevant context with + Load selection (the layer it's supposed to operate on, the comp, etc.).
- Hit Run. Read the error.
- Select the line the error references → Ask → describe the failure. The AI sees the selected line plus the surrounding code as context.
- Use Edit to take the fix the AI suggested. Accept, Run, repeat.
Hand-write with AI as backup
- Start typing with autocomplete. Lean on
comp.,layer., the info panel. - When you get stuck, select the line in progress → Ask. Get a hint without context-switching.
- Wrap the section in an undo group: select your code → Edit → "wrap in an undo group named X".
- Format (Ctrl + Shift + F) before saving so the indentation is consistent.
Friendly gotchas
- Synthesized globals don't exist at runtime. See the autocomplete callout above. Add the canonical
var comp = …;declarations before pasting into AE. - Drift kills pending edits. Sidekick refuses to apply an AI Edit that was generated against a now-stale buffer. Re-ask the edit after you make manual changes.
- Run uses your real project. The buffer executes against the currently open AE comp. Save first if you're iterating on something destructive.
- One conversation per editor session. The chat inside the editor is separate from the main Question / Expression / Script chat. Reload the panel and both come back.
Stuck? Troubleshooting covers the usual suspects, or hit FAQs for the short questions.