Answers.Body: <p>I found the right property that has to be changed and wrote a function that does the job:</p>
  
  <pre class="lang-js prettyprint-override"><code>function renameComposition(newName) {
      var curComp = null;
      for (var i = 1; i &lt; app.project.numItems +1; i++) {
          if(app.project.item(i) instanceof CompItem) {
              curComp = app.project.item(i);
              curComp.name = newName;
          } 
      }
  } 
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-18T10:03:07.360Z
Answers.Text: Beware, though, that this changes teh names of every composition in your project to newName. That does not matter in my case, just fyi.
Answers.UserDisplayName: EluciusFTW
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-11T08:42:11.270Z
Answers.LastActivityDate: 2016-10-11T09:12:56.403Z
Answers.LastEditDate: 2016-10-11T09:12:56.403Z
Answers.UserDisplayName: EluciusFTW
Body: <p>I am rendering a project several times, and use a script to change some of the input. However, I have not figured out how to change the name of the output file in the script. </p>
  
  <p>This is basically my script. I left the details of my modifying function out as they are irrelevant.</p>
  
  <pre class="lang-js prettyprint-override"><code>app.beginSuppressDialogs();
  {
      var projectFile File("C:\\AfterFX\\MyProject.aep");
      app.open(projectFile);
      MyCustomDataExchangeFunction();
      app.executeCommand(3800);
  }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-11T07:52:18.293Z
Comments.Text: In case anybody is wondering, app.executeCommand(3800) sends the composition to the Adobe media encoder.
Comments.UserDisplayName: EluciusFTW
Tags: <after-effects><after-effects-scripting><extendscript>
Title: Change Output file name in AfterFX .jsx script
UserDisplayName: EluciusFTW
ThreadText: # Change Output file name in AfterFX .jsx script
  
  (Asked by: username_0 on 2016-10-11)
  
  I am rendering a project several times, and use a script to change some of the input. However, I have not figured out how to change the name of the output file in the script.
  
  This is basically my script. I left the details of my modifying function out as they are irrelevant.
  
  ```js
  app.beginSuppressDialogs();
  {
      var projectFile File("C:\\AfterFX\\MyProject.aep");
      app.open(projectFile);
      MyCustomDataExchangeFunction();
      app.executeCommand(3800);
  }
  
  ```
  
  **Tags:** after-effects, after-effects-scripting, extendscript
  
  > **Comments:**
  > **username_0**: In case anybody is wondering, app.executeCommand(3800) sends the composition to the Adobe media encoder.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-10-11. Score: 2 | Accepted answer
  
  I found the right property that has to be changed and wrote a function that does the job:
  
  ```js
  function renameComposition(newName) {
      var curComp = null;
      for (var i = 1; i < app.project.numItems +1; i++) {
          if(app.project.item(i) instanceof CompItem) {
              curComp = app.project.item(i);
              curComp.name = newName;
          } 
      }
  } 
  
  ```
  
  > **Comments:**
  > **username_0**: Beware, though, that this changes teh names of every composition in your project to newName. That does not matter in my case, just fyi.  
  
  ---
  
  