Numbered Adjustment Layers
Posted: December 11th, 2013, 2:22 pm
I use this script to create adjustment layers.
The problem is that every layer created with it is named "Adjustment Layer," instead of Adjustment Layer 1,2,3 ... as when manually choosing New -> Adjustment Layer.
Is there a way to have the script discover the name and numbers of the existing adjustment layers and name the new one in succession?
Thanks
Code: Select all
{
var activeItem = app.project.activeItem;
if (activeItem == null || !(activeItem instanceof CompItem)){
alert("Please establish a comp as the active item and run the script again");
} else {
app.beginUndoGroup("Levels Adjust");
var activeComp = activeItem;
var solidName = "Adjustment Layer ";
var solidW = activeComp.width;
var solidH = activeComp.height;
var solidPixelAspectRatio = activeComp.pixelAspect;
var solidDuration = activeComp.duration;
var adjLayer = activeComp.layers.addSolid([1, 1, 1], solidName, solidW, solidH, solidPixelAspectRatio, solidDuration);
adjLayer.adjustmentLayer = true;
adjLayer.guideLayer = false;
adjLayer.moveToBeginning();
app.endUndoGroup();
}
}
Is there a way to have the script discover the name and numbers of the existing adjustment layers and name the new one in succession?
Thanks