Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
motionmike
Topic Author
Posts: 2
Joined: Tue Apr 12, 2016 3:59 pm

Adding a loop to Render que help

Tue Aug 09, 2016 3:38 pm

Hello,
I have written a script that will add a comp to the render que / alter the name and render path. It is working fine. I am just having trouble figuring out how to wrap it into a loop - so that I can add multiple comps at the same time. Any help would be much appreciated.

Thanks in advance

code:
//TITLE - Highlight Board Render Script

/*Goals
A
1. add comp to render queue
2. set template to MBProxy
3. remove "z_" from comp name
4. set output folder to "Final Renders"
5. add subfolder to "Final Renders" with project date
6. add "project date" to name of rendered output

*/

// prjLib Import
var activeItem = app.project.activeItem;
var selectionItem = app.project.selection;
var prj = app.project;
var prjName = app.project.file.name;
var prjPath = app.project.file;
var myRQ = prj.renderQueue;
var prjNameLength = prjName.length
var renderPath = prjPath.toString().slice(0, -prjNameLength) + "06_Final_Renders/";
var prjDate = prjName.toString().slice(prjNameLength-8, prjNameLength-4);

// Specific Vars
var renderPathString = renderPath.toString();
var templateMainboard = "Mainboard";
var mainboardProxy = "MB_Proxy";
var movSlice = oldName.toString().slice(4 , (oldName.length))
var CompNameMinusExt = oldName.toString().slice(0 , -4)



// Add comp to render queue
myRQ.items.add(activeItem)


// Apply Mainboard Template
myRQ.item(1).outputModules[1].applyTemplate(templateMainboard);

// Rename output file
var oldName = myRQ.item(1).outputModule(1).file.name;
var CompNameMinusExt = oldName.toString().slice(0 , -4)

// Create date folder
var f = new Folder( renderPath + prjDate);
f.create();

// Set output folder to "Final Renders"
myRQ.item(1).outputModule(1).file = new File(renderPath + prjDate + "/" + CompNameMinusExt.toString().slice(2, (CompNameMinusExt.length)) + "_" + prjDate + ".mov");
 
motionmike
Topic Author
Posts: 2
Joined: Tue Apr 12, 2016 3:59 pm

Re: Adding a loop to Render que help

Sun Aug 14, 2016 8:35 am

Figured it out! Just in case it might help someone else - below is the revised script.

//TITLE - Highligh Board Render Script

/*Goals
A
1. add comp to render queue
2. set template to Mainboard
3. remove "z_" from comp name
4. set output folder to "Final Renders"
5. add subfolder to "Final Renders" with project date
6. add "project date" to name of rendered output

*/

// prjLib Import
var activeItem = app.project.activeItem;
var selectionItem = app.project.selection;
var prj = app.project;
var prjName = app.project.file.name;
var prjPath = app.project.file;
var myRQ = prj.renderQueue;
var prjNameLength = prjName.length
var renderPath = prjPath.toString().slice(0, -prjNameLength) + "06_Final_Renders/";
var prjDate = prjName.toString().slice(prjNameLength-8, prjNameLength-4);

// Specific Vars
var renderPathString = renderPath.toString();
var templateMainboard = "Mainboard";
var sel_vids = app.project.selection;
var templatename = "Mainboard";

// script

var sel_vids = app.project.selection;

// A_1_Add comps to render que
if(sel_vids){

var rQ = app.project.renderQueue;
for(var i = 0; i<sel_vids.length; i++){
rQ.items.add(sel_vids[i]);

//A_2_Add Template
rQ.item(rQ.items.length).outputModules[1].applyTemplate(templatename)


// A_3_Rename output file
var oldName = myRQ.item(rQ.items.length).outputModule(1).file.name;
var CompNameMinusExt = oldName.toString().slice(0 , -4)

// B_4_Create date folder
var f = new Folder( renderPath + prjDate);
f.create();

// A_4_Set output folder to "Final Renders"
// A_5_Add Project Date to file name
myRQ.item(rQ.items.length).outputModule(1).file = new File(renderPath + prjDate + "/" + CompNameMinusExt.toString().slice(2, (CompNameMinusExt.length)) + "_" + prjDate + ".mov");

}

}

Who is online

Users browsing this forum: No registered users and 3 guests