FORUMS: list search recent posts

Run AE Script on Multiple Comps

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jacob Thorup
Run AE Script on Multiple Comps
on Apr 23, 2019 at 7:20:55 pm

I'm new to the scripting world, but I've created a script and I would like to execute it on all the comps in a folder (180 comps) without having to manually opening each comp and executing the script.

Not sure how to approach this. I've been looking in the After Effects Scripting guide, but am not sure where to start.

Thanks


Return to posts index

Walter Soyka
Re: Run AE Script on Multiple Comps
on Apr 24, 2019 at 3:31:13 pm

Here's some commented sample code that processes each comp selected in the project panel:

// put your comp-processing code in this function
// we're just going to add "_processed" as a suffix to the comp's name as proof of concept
function processComp(myComp) {
if (myComp instanceof CompItem) {
myComp.name += "_processed";
}
}



// this could be a massive change, so let's make sure we can undo it if we want
app.beginUndoGroup("Process selected comps");

// get the project selection so that we can change the items
// working directly on app.project.selection might cause the sort/selection order to change,
// so we'll work from an object that represents the initial state of the selection
var projectSelection = app.project.selection;

// step through the entire selection set. For each item that's a comp, call our processComp() function
for (var selectionIndex = 0; selectionIndex < projectSelection.length; selectionIndex++) {
if (projectSelection[selectionIndex] instanceof CompItem) processComp(projectSelection[selectionIndex]);
}

// close the Undo group after we've finished
app.endUndoGroup();


This should give you a good start. Let me know if you have any questions!

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]