<p>Have you got the latest version? After Effects CC 2018 is all about <a href="https://helpx.adobe.com/after-effects/how-to/create-data-driven-animations.html" rel="nofollow noreferrer">data driven animation.</a> </p>

<p>Either way you can use external file to drive expressions (in older versions too) using the <code>eval</code> javascript function. I <a href="http://blob.pureandapplied.com.au/using-data-from-an-external-file-to-drive-expressions/" rel="nofollow noreferrer">explain it on my blog</a> thus:</p>

<p>If you have a file that contains something like this:</p>

<pre><code>var vals = {"rotation":8, "scaleX":150, "scaleY":200};
</code></pre>

<p>you can use this expression, e.g. in the scale property:</p>

<pre><code>$.evalFile("/path/to/test.js"); // or "c:\path\to\test.js"
[eval(vals).scaleX, eval(vals).scaleY]
</code></pre>

<p>the first line reads the file and treats it as source for the expression, so vals is defined as an object with rotation, scaleX and scaleY properties, which we access as the value for our scale property.</p>

<p>In your case you'd be wanting to use the expression for the <strong>Source Text</strong> property, so your data file might be something like</p>

<pre><code>var vals = {"comp1": {line1:"Doctor MCDoctorface", line2:"Surgeon"},
            "comp2": {line1:"Skinner McHackett", line2:"Butcher}…
           }
</code></pre>

<p>So that's an array of arrays, where each comp has 2 values, line1 and line2. In your expression you'd loop through the array, until you found the member of the outer array whose name matched <code>thisComp.name</code> and then use the appropriate member for line 1 and 2.</p>

<p>To automate your rendering you can use the built-in command line renderer aerender (aka aerender.exe). With a bit of shell scripting you can automate the whole workflow.</p>

CC BY-SA 3.0
2017-10-24T00:13:36.760Z
2017-10-24T00:13:36.760Z
stib
<p>And also one little trick: you can copy-paste key-frames. And you can copy-paste it as text! Just copy all your animation key-frames and paste to notepad.exe or other text editor! Pretty cool? You can write own script in any language to generate text with same structure and import many data in AE in such way.</p>

<p>Unfortunately, this works only with animation key-frames. But this one day saved too much time for me.</p>

CC BY-SA 3.0
2017-10-24T14:04:35.570Z
2017-10-24T14:04:35.570Z
bukkojot
<p>I am often rendering quite large sets of assets (lower thirds, titles, etc) from AFX and it's really annoying to eg create lower third and then duplicate it and change texts. Especially when I later need to change something globally and have to return to every single copy of that graphic.</p>

<p>Is there maybe a way to load data from external file (like XML or JSON) and then repeat render for each row / set in that file? So I could basically create lower third with text fields "name" and "company" and then specify multiple values for those fields in external file and then just have AFX render my composition with each set of values?</p>

<after-effects><automation><after-effects-scripting>
Automate After Effects assets rendering via script and external data
Delltar
# Automate After Effects assets rendering via script and external data

(Asked by: username_0 on 2017-10-23)

I am often rendering quite large sets of assets (lower thirds, titles, etc) from AFX and it's really annoying to eg create lower third and then duplicate it and change texts. Especially when I later need to change something globally and have to return to every single copy of that graphic.

Is there maybe a way to load data from external file (like XML or JSON) and then repeat render for each row / set in that file? So I could basically create lower third with text fields "name" and "company" and then specify multiple values for those fields in external file and then just have AFX render my composition with each set of values?

**Tags:** after-effects, automation, after-effects-scripting


---

## 2 answers

### Answer by username_1 on 2017-10-24. Score: 2

Have you got the latest version? After Effects CC 2018 is all about data driven animation. 
Either way you can use external file to drive expressions (in older versions too) using the eval javascript function. I explain it on my blog thus:
If you have a file that contains something like this:
var vals = {"rotation":8, "scaleX":150, "scaleY":200};

you can use this expression, e.g. in the scale property:
$.evalFile("/path/to/test.js"); // or "c:\path\to\test.js"
[eval(vals).scaleX, eval(vals).scaleY]

the first line reads the file and treats it as source for the expression, so vals is defined as an object with rotation, scaleX and scaleY properties, which we access as the value for our scale property.
In your case you'd be wanting to use the expression for the Source Text property, so your data file might be something like
var vals = {"comp1": {line1:"Doctor MCDoctorface", line2:"Surgeon"},
            "comp2": {line1:"Skinner McHackett", line2:"Butcher}…
           }

So that's an array of arrays, where each comp has 2 values, line1 and line2. In your expression you'd loop through the array, until you found the member of the outer array whose name matched thisComp.name and then use the appropriate member for line 1 and 2.
To automate your rendering you can use the built-in command line renderer aerender (aka aerender.exe). With a bit of shell scripting you can automate the whole workflow.


---

### Answer by username_2 on 2017-10-24. Score: 0

And also one little trick: you can copy-paste key-frames. And you can copy-paste it as text! Just copy all your animation key-frames and paste to notepad.exe or other text editor! Pretty cool? You can write own script in any language to generate text with same structure and import many data in AE in such way.

Unfortunately, this works only with animation key-frames. But this one day saved too much time for me.


---

