Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Close a comp panel from Timeline Panels by a script

Community Beginner ,
Jan 23, 2024 Jan 23, 2024

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

TOPICS
Expressions , Scripting
200
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Jan 23, 2024 Jan 23, 2024

 

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

activeComp.openInViewer();

source: 

Translate
Advocate ,
Jan 23, 2024 Jan 23, 2024

 

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

activeComp.openInViewer();

source: 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 28, 2024 Jan 28, 2024
LATEST

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);
  }
}




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines