Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Extend length of comp to match the longest layer

  • Extend length of comp to match the longest layer

    Posted by Xavier Paredes on November 23, 2022 at 1:50 pm

    I have a lot of comps (74) all of which have a layer that extends past the length of the comp. I now need to adjust the length of the comp so nothing gets left out.

    I know I can do this manually by opening the Comp Settings pop-up but I’m hoping there’s a shortcut or faster way?


    Xavier Paredes replied 1 year ago 3 Members · 4 Replies
  • 4 Replies
  • Graham Quince

    November 26, 2022 at 10:47 pm

    Not used it myself, but maybe something like this tool would help:

  • Walter Soyka

    December 1, 2022 at 5:42 pm

    I’m way late to the party, but this would make a useful script. Save this code as a .jsx file, and it will step through all selected comps, extending their duration to the latest out point of its layers.

    var projectSelection = app.project.selection;
    if (projectSelection.length == 0) {
    alert("Select one or more comps in the project panel.");
    } else {
    app.beginUndoGroup("Extend selected comps to longest layer");
    writeLn("Extending selected comps to longest layer...");
    var processedCompsCount = 0;
    var modifiedCompsCount = 0;
    for (var i = 0; i < projectSelection.length; i++) {
    if (projectSelection[i] instanceof CompItem) {
    var modifiedComp = false;
    var currentComp = projectSelection[i];
    for (var j = 1; j <= currentComp.numLayers; j++) {
    if (currentComp.layer(j).outPoint > currentComp.duration) {
    currentComp.duration = currentComp.layer(j).outPoint;
    modifiedComp = true;
    if (modifiedComp) { modifiedCompsCount++; }
    writeLn("Processed " + processedCompsCount + " comp" + (processedCompsCount == 1 ? "" : "s") + " and modified " + modifiedCompsCount + ".");
  • Xavier Paredes

    December 1, 2022 at 7:48 pm

    Hi Walter,

    I wound up using Keyboard Maestro to automate the repetitiveness. But I will test your solution next time I have a similar project.

    I really appreciate you posting this solution.

  • Xavier Paredes

    December 1, 2022 at 7:56 pm

    UPDATE: I just tested it and works like a charm!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy