execute_extendscript
Execute custom ExtendScript code in Premiere Pro to automate tasks like modifying clips, sequences, or properties. Use ES3 syntax with built-in helpers.
Instructions
Execute custom ExtendScript code in Premiere Pro. The code runs inside an IIFE with helper functions available.
IMPORTANT: You MUST write ES3 syntax (var instead of let/const, no arrow functions, no template literals, no destructuring).
Available helpers (auto-prepended):
__ticksToSeconds(ticks) / __secondsToTicks(seconds) — time conversion
__ticksToTimecode(ticks, fps) — timecode string
__findSequence(idOrName) — find sequence by name or ID
__findProjectItem(nodeIdOrName) — find project item recursively
__findClip(nodeId) — find clip in active sequence, returns {clip, trackIndex, clipIndex, trackType}
__getAllClips(seq) — get all clips in a sequence
__result(data) — return success with data (MUST call this or __error)
__error(msg) — return error message
TICKS_PER_SECOND — constant 254016000000
app.enableQE() — enable QE DOM access
Your code MUST end with: return __result({...}) or return __error("message")
Example: Set opacity to 50% on all video clips var seq = app.project.activeSequence; if (!seq) return __error("No active sequence"); var count = 0; for (var t = 0; t < seq.videoTracks.numTracks; t++) { var track = seq.videoTracks[t]; for (var c = 0; c < track.clips.numItems; c++) { var clip = track.clips[c]; for (var i = 0; i < clip.components.numItems; i++) { var comp = clip.components[i]; if (comp.displayName === "Opacity") { for (var p = 0; p < comp.properties.numItems; p++) { if (comp.properties[p].displayName === "Opacity") { comp.properties[p].setValue(50, true); count++; } } } } } } return __result({updated: count});
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ExtendScript code to execute (ES3 syntax). Must use return __result({...}) or return __error('...'). Helpers are auto-prepended. | |
| timeout_ms | No | Custom timeout in milliseconds (default: 30000). Increase for long operations. |