Skip to content

Instantly share code, notes, and snippets.

@colormono
Created August 29, 2013 20:25
Show Gist options
  • Save colormono/6382969 to your computer and use it in GitHub Desktop.
Save colormono/6382969 to your computer and use it in GitHub Desktop.
Add solids to multiple compositions
/* Add solids to multiple compositions */ try{ // Variables var proj = app.project; var itemsTotal = proj.numItems; var solidColor = [0, 0, 1]; var curItem, curItemLayers, compName, compWidth, compHeight, compPAR, compDur, solidName, curSolid, totalComps; var itemAry = new Array(); // Loop through project item app.beginUndoGroup("Add new solids"); for( var i=1; i<= itemsTotal; i++ ){ // Item assignment curItem = proj.item(i); // Check if item is a comp if ( curItem instanceof CompItem ){ itemAry[itemAry.length] = curItem; } } totalComps = itemAry.length; for( var c=0; c<totalComps; c++ ){ // Variable assignment curItemLayers = itemAry[c].layers; compName = itemAry[c].name; compWidth = itemAry[c].width; compHeight = itemAry[c].height; compPAR = itemAry[c].pixelAspect; compDur = itemAry[c].duration; solidName = "Blue Solid in " + compName; // Add the new solid curSolid = curItemLayers.addSolid( solidColor, solidName, compWidth, compHeight, compPAR, compDur ); // Update info panel with progress writeLn( solidName + " created" ); } writeLn("All done."); app.endUndoGroup(); // If an error occures, catch it and show me } catch( err ){ alert( "Error at line # " + err.line.toString() + "\r" + err.toString() ); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment