I have been trying to make a script that will automatically apply an effect to the selected layer. So far, it looks like this:

var myLayer = app.project.activeItem.selectedLayers[0];

I have seen here and here the use of the Effects attribute, which is used like this:

var myEffect = myLayer.Effects.addProperty("My Effect");

The only class I found in the CS3 scripting guide that has the addProperty method was the PropertyGroup object, found on page 147. There is no mention of myLayer.Effects. In fact, I have not seen an attribute with a capitalized first letter before.

I am going to use this to automate creating around 100 circles on a layer. (This effect is found under Effects & Presets > Generate > Circle.) I want to be able to provide a list of X/Y coordinates and for each one generate a circle with this center and a fixed size. This list could come from a file or from a list of each null object on the same layer.

  • Could you use circular shape layers instead of effects?
    – stib
    Commented Nov 9, 2014 at 12:04

1 Answer 1


I actually found the answer in the CS3 scripting guide. CompItem#selectedLayers actually returns an array of AVLayer objects. AVLayer is a subclass of Layer and has quite a few attributes. Here are a few of them:

  • Masks
  • Effects
  • Anchor points
  • Position
  • Scale
  • X Rotation
  • Y Rotation
  • Opacity

Oddly enough, when calling these attributes you need to pay attention to if the attribute is one word or two. If it's one word, the first letter will be capitalized, but if it's two words the first letter will be lower case and the rest in camel case fasion.

For example, if you have an AVLayer instance called myLayer and you want to get its list of effects you call myLayer.Effects, but if you want to get its X rotation you call myLayer.xRotation.

As for my end goal of creating circles on a selected layer, this is what I came up with (works in CS5.5 although it also needs error checking to see if a layer is actually selected!):

function createCircle(layer, coords, radius) {
    var x = coords[0];
    var y = coords[1];

    var circle = layer.Effects.addProperty("Circle");
    circle.Center.setValue([x, y]);
    return circle

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var circles = [];

//coordsList could come from an external file or another function
for (var i = 0; i < coordsList.length; i++) {
    circles.push(createCircle(myLayer, coordsList[i], 75));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.