-
script to copy multiple paths from one layer to multiple masks on another layer?
hi,
for starters, i have never wrote scripts in AE, only expression, so saying im new to this is an understatement.
i have a shape layer with 300+ paths and i need to copy every path into an adjustment layer as a mask. i have done this manually by copying the path from the shape, add a new mask in the adjustment layer, and paste it there, but because i have to do this a lot of times, i kinda need a script. i tried my best with what’s below, so far ive managed to copy the path, add mask, paste the path as a mask, delete the first path. any ideas how to make this a loop?
var myComp = app.project.activeItem;
var mySourceLayer = myComp.layer(“de sters”);
var myPath = mySourceLayer.property(“Contents”).property(1).property(“Path”);
mySourceLayer.selected = true;
myPath.selected = true;
app.executeCommand(19); //Copy
myPath.selected = false;
mySourceLayer.selected = false;
var myShape = myPath.value;
var myDestLayer = myComp.layer(“1”);
var myNewMask = myDestLayer.property(“Masks”).addProperty(“Mask”);
var myNewPath = myNewMask.property(“Mask Path”);
//myNewPath.setValue(myShape);
myDestLayer.selected = true;
myNewMask.selected = true;
myNewPath.selected = true;
app.executeCommand(20); //Paste
myDestLayer.selected = false;
mySourceLayer.selected = true;
myPath.selected = true;
app.executeCommand(18); //Copy