Skip to content

Instantly share code, notes, and snippets.

@iancullinane
Created March 7, 2023 15:47
Show Gist options
  • Select an option

  • Save iancullinane/bc46c46334ee3572682726fa6fbffb77 to your computer and use it in GitHub Desktop.

Select an option

Save iancullinane/bc46c46334ee3572682726fa6fbffb77 to your computer and use it in GitHub Desktop.
Loop and replace text in after effects
// 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