Answers.Body: <p>Depends on which scripting languages your web server supports.</p>
  
  <h3>Main requirements</h3>
  
  <ol>
  <li>The language should be able to <strong>execute the application</strong></li>
  <li>The language should <strong>provide secure access</strong> the files on the server or a network</li>
  <li>The language should provide methods to <strong>assembly file paths</strong> (e.g. relative to absolute paths)</li>
  <li>The language should provide <strong>interaction methods</strong> for connecting the webpage (user input) and <em>your application</em>, also see: <a href="https://en.wikipedia.org/wiki/Web_application_framework" rel="nofollow">https://en.wikipedia.org/wiki/Web_application_framework</a></li>
  </ol>
  
  <hr>
  
  <h3>Execute aerender via python</h3>
  
  <p>Assuming your webserver supports <a href="https://www.python.org/" rel="nofollow">python</a>, execute the app via <a href="https://docs.python.org/3/library/subprocess.html" rel="nofollow">python's subprocess module</a>. <em>You only have to make sure that you can call</em> <code>aerender</code> <em>from your command line properly.</em></p>
  
  <pre class="lang-py prettyprint-override"><code># import subprocess module to call aerender
  import subprocess 
  
  # create a aerender argument list
  args = ['aerender', '-project', 'path_to_file']
  process = subprocess.Popen(args, stdout=PIPE, stderr=PIPE)
  </code></pre>
  
  <p>In order to <strong>batch process</strong> a folder of <code>.aep</code> files you'll need to iterate through the files:</p>
  
  <pre class="lang-py prettyprint-override"><code>#import os module
  import os 
  
  # set the path to your aep folder
  path = '/home/user/Desktop/aep-files'    # linux or osx
  # path = r'c:\some\directory\aep-files'  # windows, the r is important
  # path = 'c:/some/directory\aep-files'   # windows (alternative)
  
  # make sure the files are .aep files
  aep_file_folder = [f for f in os.listdir(path) if f.endswith('.aep')] 
  
  # iterate through the list
  for i in aep_file_folder:
      # setup correct filepath for aeps
      file_path = os.path.join(path,i)
  
      # call aerender with the correct arguments
      subprocess.call(['aerender', '-project', file_path])
  </code></pre>
  
  <p><strong>Note:</strong> If there is no need to communicate (e.g. getting the output of aerender) you can simply use <code>subprocess.call</code> instead.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-09T16:03:09.963Z
Answers.LastActivityDate: 2015-09-09T16:03:09.963Z
Answers.UserDisplayName: p2or
Body: <p>What's the easiest way to trigger an aerender command from a web page?</p>
  
  <p>Using <a href="http://aescripts.com/templater/" rel="nofollow">Templater</a>, I can create renders based on google spreadsheets, but I can't find a good description of how to trigger a render remotely.  Is there a good howto guide somewhere?  Maybe using PHP or something (not an expert on this)... PS: I'm using a Mac</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-11T09:39:31.717Z
Comments.Text: In general php is not made for this purpose, I would you advise against it. Usually then it only remains ruby and python on a web server. I would recommend python, since it's often used and there are many film-related libraries. Also, there is a build-in csv module to parse a spreadsheet. I thought it's a good idea to include site relevant code (how to trigger aerender), because all the other topics seems more fitting for stackoverflow (imo). It's a really interessting question, but it's also quite complex, thus my answer is a rough overview only, so let me know what else you need.
Comments.UserDisplayName: p2or
Tags: <after-effects><aerender>
Title: How to trigger an aerender command from a web page
UserDisplayName: tomh
ThreadText: # How to trigger an aerender command from a web page
  
  (Asked by: username_0 on 2015-09-09)
  
  What's the easiest way to trigger an aerender command from a web page?
  
  Using [Templater](http://aescripts.com/templater/), I can create renders based on google spreadsheets, but I can't find a good description of how to trigger a render remotely. Is there a good howto guide somewhere? Maybe using PHP or something (not an expert on this)... PS: I'm using a Mac
  
  **Tags:** after-effects, aerender
  
  > **Comments:**
  > **username_1**: In general php is not made for this purpose, I would you advise against it. Usually then it only remains ruby and python on a web server. I would recommend python, since it's often used and there are many film-related libraries. Also, there is a build-in csv module to parse a spreadsheet. I thought it's a good idea to include site relevant code (how to trigger aerender), because all the other topics seems more fitting for stackoverflow (imo). It's a really interessting question, but it's also quite complex, thus my answer is a rough overview only, so let me know what else you need.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-09. Score: 3 | Accepted answer
  
  Depends on which scripting languages your web server supports.
  
  ### Main requirements
  
  1. The language should be able to **execute the application**
  2. The language should **provide secure access** the files on the server or a network
  3. The language should provide methods to **assembly file paths** (e.g. relative to absolute paths)
  4. The language should provide **interaction methods** for connecting the webpage (user input) and *your application*, also see: <https://en.wikipedia.org/wiki/Web_application_framework>
  
  ---
  
  ### Execute aerender via python
  
  Assuming your webserver supports [python](https://www.python.org/), execute the app via [python's subprocess module](https://docs.python.org/3/library/subprocess.html). *You only have to make sure that you can call* `aerender` *from your command line properly.*
  
  ```py
  # import subprocess module to call aerender
  import subprocess 
  
  # create a aerender argument list
  args = ['aerender', '-project', 'path_to_file']
  process = subprocess.Popen(args, stdout=PIPE, stderr=PIPE)
  
  ```
  
  In order to **batch process** a folder of `.aep` files you'll need to iterate through the files:
  
  ```py
  #import os module
  import os 
  
  # set the path to your aep folder
  path = '/home/user/Desktop/aep-files'    # linux or osx
  # path = r'c:\some\directory\aep-files'  # windows, the r is important
  # path = 'c:/some/directory\aep-files'   # windows (alternative)
  
  # make sure the files are .aep files
  aep_file_folder = [f for f in os.listdir(path) if f.endswith('.aep')] 
  
  # iterate through the list
  for i in aep_file_folder:
      # setup correct filepath for aeps
      file_path = os.path.join(path,i)
  
      # call aerender with the correct arguments
      subprocess.call(['aerender', '-project', file_path])
  
  ```
  
  **Note:** If there is no need to communicate (e.g. getting the output of aerender) you can simply use `subprocess.call` instead.
  
  
  ---
  
  