Highlighted

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

Explorer ,
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?

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");
}
TOPICS
Scripting

Views

67

Likes

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

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

Explorer ,
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?

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");
}
TOPICS
Scripting

Views

68

Likes

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
Oct 02, 2020 0
Guide ,
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");
}

Likes

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
Reply
Loading...
Oct 02, 2020 0
Guide ,
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");
}

Likes

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
Reply
Loading...
Oct 02, 2020 0
Explorer ,
Oct 02, 2020

Copy link to clipboard

Copied

Worked like a charm. Thanks Dan!

Likes

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
Reply
Loading...
Oct 02, 2020 0