Created
March 7, 2023 15:47
-
-
Save iancullinane/bc46c46334ee3572682726fa6fbffb77 to your computer and use it in GitHub Desktop.
Loop and replace text in after effects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Loop through all text layers in the active composition | |
| for (var i = 1; i <= app.project.activeItem.layers.length; i++) { | |
| var layer = app.project.activeItem.layers[i]; | |
| if (layer instanceof TextLayer) { | |
| // Get the source text property | |
| var sourceText = layer.property("Source Text"); | |
| // Get the text value as a string | |
| var textValue = sourceText.value.toString(); | |
| // Replace all occurrences of "..." with an empty string | |
| textValue = textValue.replace(/(\.\.\.)/g, ""); | |
| // Set the new text value | |
| sourceText.setValue(textValue); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment