Skip to content

Premiere Pro ExtendScript

Rules for ExtendScript in Premiere Pro (jsx/ppro/): no undo groups, times in ticks, 0-based track and clip collections, no QE DOM, and the version range.

Read host.md first: it explains AP.host.eval and how jsx/ is loaded. This page is about code that runs in Premiere Pro. Put code that only makes sense in Premiere Pro in jsx/ppro/.

Premiere Pro’s ExtendScript has no beginUndoGroup. Every change a script makes (a clip moved, a marker added, a property set) is its own step in Edit → Undo. Keep scripted edits small, do the checks before the first change, and tell the user how many undo steps an action adds. ap host eval cannot group them either.

app.project.activeSequence is null when no sequence is open. Check it:

function myTool_sequenceInfo() {
var sequence = app.project.activeSequence;
if (!sequence) return JSON.stringify({ ok: false, message: "Open a sequence first." });
var clips = 0;
for (var i = 0; i < sequence.videoTracks.numTracks; i++) {
clips += sequence.videoTracks[i].clips.numItems;
}
return JSON.stringify({ ok: true, name: sequence.name, videoClips: clips });
}

Tracks, clips, sequences and project items are 0-based collections with a count property: sequence.videoTracks[0] with numTracks, track.clips[0] with numItems, app.project.sequences[0] with numSequences, app.project.rootItem.children[0] with numItems. Use a for loop; they are not arrays.

Premiere measures time in ticks: 254016000000 ticks per second. A Time object has .seconds (a number) and .ticks (a string). Create one with new Time() and set either:

var t = new Time();
t.seconds = 2.5;
app.project.activeSequence.setPlayerPosition(t.ticks); // move the playhead to 2.5 s
var startSeconds = clip.start.seconds; // read a clip's start

Frame-accurate maths: convert with the sequence’s timebase (sequence.timebase, ticks per frame, a string) instead of rounding seconds.

  • The QE DOM (app.enableQE(), qe.*): undocumented, unsupported, and it changes between versions. Do not ship code that needs it.
  • Dialogs (alert, confirm, File.openDialog) block Premiere Pro while open; the panel can show its own UI instead.
  • app.project is the active project. Premiere Pro can have several projects open (app.projects, numProjects).
  • Save with app.project.save(). ap host scratch creates a new project in the temp folder and leaves the user’s project open.

The extension’s range is hosts[].minVersion in afterpresets.json (default 14.0, Premiere Pro 2020). Check app.version before using newer APIs and return { ok: false, message } when they are missing.

ap check --types checks jsx/ against the Premiere Pro 24.0 declarations from types-for-adobe (the newest set; newer APIs may be missing) and lists likely mistakes. Hints can be wrong; confirm with ap host eval.