Skip to main content
Participant
January 23, 2024
Answered

Close a comp panel from Timeline Panels by a script

  • January 23, 2024
  • 1 reply
  • 348 views

I would like a function that can close all other comps but the active one from the timeline pannel.

This topic has been closed for replies.
Correct answer Airweb_AE

 

 var activeComp = app.project.activeItem;
do {
     app.executeCommand(4);
     } while(app.project.activeItem != null && app.project.activeItem instanceof CompItem);

activeComp.openInViewer();

source: 

1 reply

Airweb_AECorrect answer
Legend
January 23, 2024

 

 var activeComp = app.project.activeItem;
do {
     app.executeCommand(4);
     } while(app.project.activeItem != null && app.project.activeItem instanceof CompItem);

activeComp.openInViewer();

source: 

awn5FA3Author
Participant
January 28, 2024

Thank you so much @Airweb_AE ! it works perfectly.

I also found this one in the comments of this video:

var projectItems = app.project.items;
var activeItem = app.project.activeItem;
for (var i = 1; i <= projectItems.length; i++) {
  if (
    app.project.item(i) instanceof CompItem &&
    app.project.item(i) != activeItem
  ) {
    app.project.item(i).openInViewer();
    app.executeCommand(4);
  }
}