Answers.Body: <p>I actually found the answer in the <a href="http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/aftereffects/pdfs/aftereffectscs3_scripting_guide.pdf" rel="nofollow">CS3 scripting guide</a>. <code>CompItem#selectedLayers</code> actually returns an array of <code>AVLayer</code> objects. <code>AVLayer</code> is a subclass of <code>Layer</code> and has quite a few  attributes. Here are a few of them:</p>
  
  <ul>
  <li>Masks</li>
  <li>Effects</li>
  <li>Anchor points</li>
  <li>Position</li>
  <li>Scale</li>
  <li>X Rotation</li>
  <li>Y Rotation</li>
  <li>Opacity</li>
  </ul>
  
  <p>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. </p>
  
  <p>For example, if you have an AVLayer instance called <code>myLayer</code> and you want to get its list of effects you call <code>myLayer.Effects</code>, but if you want to get its X rotation you call <code>myLayer.xRotation</code>.</p>
  
  <hr>
  
  <p>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!):</p>
  
  <pre class="lang-js prettyprint-override"><code>function createCircle(layer, coords, radius) {
      var x = coords[0];
      var y = coords[1];
  
      var circle = layer.Effects.addProperty("Circle");
      circle.Center.setValue([x, y]);
      circle.Radius.setValue(radius);
      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 &lt; coordsList.length; i++) {
      circles.push(createCircle(myLayer, coordsList[i], 75));
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-11T00:40:24.663Z
Answers.LastActivityDate: 2016-07-20T12:36:19.633Z
Answers.LastEditDate: 2016-07-20T12:36:19.633Z
Answers.UserDisplayName: hololeap
Body: <p>I have been trying to make a script that will automatically apply an effect to the selected layer. So far, it looks like this:</p>
  
  <pre><code>var myLayer = app.project.activeItem.selectedLayers[0];
  </code></pre>
  
  <p>I have seen <a href="https://forums.creativecow.net/thread/227/12683#12690" rel="nofollow">here</a> and <a href="http://omino.com/pixelblog/category/extendscript/" rel="nofollow">here</a> the use of the <code>Effects</code> attribute, which is used like this:</p>
  
  <pre><code>var myEffect = myLayer.Effects.addProperty("My Effect");
  </code></pre>
  
  <p>The only class I found in the <a href="http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/aftereffects/pdfs/aftereffectscs3_scripting_guide.pdf" rel="nofollow">CS3 scripting guide</a> that has the <code>addProperty</code> method was the <code>PropertyGroup</code> object, found on page 147. There is no mention of <code>myLayer.Effects</code>. In fact, I have not seen an attribute with a capitalized first letter before.</p>
  
  <p>I am going to use this to automate creating around 100 circles on a layer. (This effect is found under <strong>Effects &amp; Presets</strong> > <strong>Generate</strong> > <strong>Circle</strong>.) 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.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-09T12:04:31.073Z
Comments.Text: Could you use circular shape layers instead of effects?
Comments.UserDisplayName: stib
Tags: <after-effects><after-effects-expressions><extendscript><after-effects-scripting>
Title: Scripting - Where is the documentation for the Layer#Effects attribute?
UserDisplayName: hololeap
ThreadText: # Scripting - Where is the documentation for the Layer#Effects attribute?
  
  (Asked by: username_0 on 2014-11-06)
  
  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](https://forums.creativecow.net/thread/227/12683#12690) and [here](http://omino.com/pixelblog/category/extendscript/) 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](http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/aftereffects/pdfs/aftereffectscs3_scripting_guide.pdf) 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.
  
  **Tags:** after-effects, after-effects-expressions, extendscript, after-effects-scripting
  
  > **Comments:**
  > **username_1**: Could you use circular shape layers instead of effects?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2014-11-11. Score: 3 | Accepted answer
  
  I actually found the answer in the [CS3 scripting guide](http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/aftereffects/pdfs/aftereffectscs3_scripting_guide.pdf). `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!):
  
  ```js
  function createCircle(layer, coords, radius) {
      var x = coords[0];
      var y = coords[1];
  
      var circle = layer.Effects.addProperty("Circle");
      circle.Center.setValue([x, y]);
      circle.Radius.setValue(radius);
      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));
  }
  
  ```
  
  
  ---
  
  