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

How do I add multiple selected comps to the render queue via Extend Script?

Contributor ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

I have an ScriptUI button that adds a single selected comp to the render queue and applies an Output module and Render module…

 

var comp = app.project.activeItem;
var item = app.project.renderQueue.items.add(comp);
var outputModule = item.outputModule(1);
outputModule.applyTemplate("Multi-Machine Sequence TIFF 8 Bit RGB");
item.applyTemplate("Multi-Machine Settings");

 

 

However I need to make it work for multiple selected comps.

 

I tried a modified version using app.executeCommand(2161); which is the Command ID for 'Add to Render Queue' but that feels like cheating haha. In any case, it doesn't quite work. It adds multiple comps, but it doesn't change the Output module. Maybe my variable syntax is wrong…

 

app.executeCommand(2161);
var item = app.project.renderQueue.items;
outputModule.applyTemplate("Multi-Machine Sequence TIFF 8 Bit RGB");
item.applyTemplate("Multi-Machine Settings");

 

 
Is there a way to do this using my original method which doesn't use a command ID? Or if not, is there a way to get my command ID version working?
TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

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

Community Expert , Oct 02, 2020 Oct 02, 2020

Oops. I left off the first line.

 

var myItems = app.project.selection;
var comp, item, outputModule;
for (var i = 0; i < myItems.length; i ++){
  if (! (myItems[i] instanceof CompItem)) continue;
  comp = myItems[i];
  item = app.project.renderQueue.items.add(comp);
  outputModule = item.outputModule(1);
  outputModule.applyTemplate("Multi-Machine Sequence TIFF 8 Bit RGB");
  item.applyTemplate("Multi-Machine Settings");
}

Votes

Translate

Translate
Community Expert ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

If you have the comps selected in the project panel, something like this should work (not tested though):

 

var comp, item, outputModule;
for (var i = 0; i < myItems.length; i ++){
  if (! (myItems[i] instanceof CompItem)) continue;
  comp = myItems[i];
  item = app.project.renderQueue.items.add(comp);
  outputModule = item.outputModule(1);
  outputModule.applyTemplate("Multi-Machine Sequence TIFF 8 Bit RGB");
  item.applyTemplate("Multi-Machine Settings");
}

Votes

Translate

Translate

Report

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 Expert ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

Oops. I left off the first line.

 

var myItems = app.project.selection;
var comp, item, outputModule;
for (var i = 0; i < myItems.length; i ++){
  if (! (myItems[i] instanceof CompItem)) continue;
  comp = myItems[i];
  item = app.project.renderQueue.items.add(comp);
  outputModule = item.outputModule(1);
  outputModule.applyTemplate("Multi-Machine Sequence TIFF 8 Bit RGB");
  item.applyTemplate("Multi-Machine Settings");
}

Votes

Translate

Translate

Report

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
Contributor ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

Worked like a charm. Thanks Dan!

Votes

Translate

Translate

Report

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
Explorer ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

LATEST

Would it be possible to also define an output name as well? [compName]_[projectName].[fileExtension]

 

Thank you,

Votes

Translate

Translate

Report

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