Don't have that guide to refer to, but here's some simple ways to apply effects, starting with the most simple:
This applies the "Levels" effect to the 1st layer in the active Comp:
Code: Select all
var myComp = app.project.activeItem;
var myLayer = myComp.layer(1);
myLayer("Effects").addProperty("Levels");
This applies the "Levels" effect to any selected layers
Code: Select all
var myComp = app.project.activeItem;
var selectedLayers = myComp.selectedLayers;
for (var i = 0; i < selectedLayers.length; i++) {
var myLayer = selectedLayers[i];
myLayer("Effects").addProperty("Levels");
}
And this prompts you to enter the name of the effect, which it then applies to the selected layers in the active comp
Code: Select all
var myEffect = "Levels";
myEffect = prompt("What effect would you like to add", myEffect);
var myComp = app.project.activeItem;
var selectedLayers = myComp.selectedLayers;
for (var i = 0; i < selectedLayers.length; i++) {
var myLayer = selectedLayers[i];
myLayer("Effects").addProperty(myEffect);
}
Hope that helps you out.. Also in AE7 you can now apply an Animation Preset through scripting which I have found more useful:
Code: Select all
var myFile = fileGetDialog("Select Animation Preset","");
var myComp = app.project.activeItem;
var selectedLayers = myComp.selectedLayers;
for (var i = 0; i < selectedLayers.length; i++) {
var myLayer = selectedLayers[i];
myLayer.applyPreset(myFile);
}
-Lloyd