Hopefully someone here can help.
Code: Select all
{
// This script will create two Adjustment layers in the activeComp.
// The adjustment layer will have Levels effect and ...
//
//
// note: This script is using matchName so that this script can work with localized build.
//
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 {
// By bracketing the operations with begin/end undo group, we can
// undo the whole script with one undo operation.
app.beginUndoGroup("Gamma up and down");
var activeComp = activeItem;
var solidName = "GAMMA DOWN";
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);
// Apply Levels
var levels = adjLayer.Effects.addProperty("Levels (Individual Controls)");
// Set Values
levels.property(6).setValue(.5);
adjLayer.adjustmentLayer = true;
//adjLayer.guideLayer = true;
adjLayer.moveToBeginning();
// Gamma Inverse
var solidName = "GAMMA INVERSE";
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);
// Apply Levels
var levels = adjLayer.Effects.addProperty("Levels (Individual Controls)");
// Set Values
levels.property(6).setValue(thisComp.layer("GAMMA DOWN")("Effects")("Levels (Individual Controls)")("Gamma"));
adjLayer.adjustmentLayer = true;
adjLayer.moveToBeginning();
app.endUndoGroup();
}
}