How to replace source text of multiple text layers in After Effects

By November 10, 2014Tutorials
I worked on one After Effects project where used a lot of text layers. In fact, each layer displayed an icon from Font Awesome. Their position and scale were managed by some sophisticated expressions. At some point I needed to replace the content of all those layers with new text. Basically I wanted that all these layers have the same content. One can suggest using sourceText property and do the job via expressions. The trouble here is that you will need to add an expression to all the layers which hardly easier then manually set the desired value.

The solution is to use Java Script in After Effects.

Select all text layers you want to affect in the composition and open Java Script editor. In After Effects menu choose File → Scripts → Open Script Editor. The Script Editor pops up with a blank document. Copy and paste the code below.

Change the ‘xxx’ string to something you need. Make sure you have selected all the text layers you want to affect. Now run the script by pressing F5 or via menu Debug → Run

I hope this small piece of code will help somebody else.

Script with explanations