Page 1 of 1

Create a text layer that displays the comp name and specifies the color and size

Posted: January 21st, 2024, 10:24 pm
by ulfstein


I'm trying to write a script that will allow me to create a text layer which shows the comp's name. What I've got works fine with the exception of being able to set the text color to white, set the size to 30px and to add a drop shadow. Is this possible?

// Get the active composition
var comp = app.project.activeItem;

// Check if a composition is active
if (comp !== null && comp instanceof CompItem) {
// Create a new text layer
var textLayer = comp.layers.addText("YOUR_TEXT_HERE"); // Replace with your desired text

// Set the text layer properties
textLayer.position.setValue([0, comp.height]); // Lower-left corner
textLayer.anchorPoint.setValue([-20, 30]); // Set anchor point to the bottom-left corner

// Set the text content to the composition name

// Print a message to the JavaScript Console
$.writeln("Text layer with the composition name created successfully");
} else {
$.writeln("No active composition found");