how to create a new comp and add the selected items to a comp (for animetion)

What type of scripts do you need?

Moderator: byronnash

Post Reply
terry1992
Posts: 1
Joined: October 10th, 2019, 10:04 pm

Hi, Im working on a script for make my work more fast.
this script supposed to create a new comp the size of the selected items in the project and then add the select items into this new comp ; finally apply some effects.
"all in one composition"; i red a post in this side and use part of the code but this code create one comp for every selected item.

i did the set up of the effects and also create a new solid but i don't know how to create a comp the size of the selected items and add all of the items into one composition.
the items could be images or composition. could someone alter this script so it does create a comp and add the selected items to this new comp please ?



var mySelectedItems = [];
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i).selected)
mySelectedItems[mySelectedItems.length] = app.project.item(i);
}

for (var i = 0; i < mySelectedItems.length; i++){
var mySelection = mySelectedItems;

//New CompSet up//
var myComp = app.project.items.addComp(mySelection.name,mySelection.width, mySelection.height,
mySelection.pixelAspect, mySelection.duration, 24);

myComp.preserveNestedFrameRate= true



//Selected CellSet up//
var myNewCell = myComp.layers.add( mySelection ); //new Layer for the Cell




//This part is working//

var myCellWhiteColor = myNewCell.Effects.addProperty("ADBE Color Key");
myCellWhiteColor.property(1).setValue([255,255,255]);
var myCellOLM = myNewCell.Effects.addProperty("OLM Smoother");

//OLMSmooth Solid Set up//
var myOLMSmoothSolid = myComp.layers.addSolid ([1,1,1],'OLM Smooth', myComp.width,
myComp.height,myComp.pixelAspect);
var myCellWhiteColor = myOLMSmoothSolid.Effects.addProperty("OLM Smoother");
myOLMSmoothSolid.adjustmentLayer = true;

}
Post Reply