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

What type of scripts do you need?

Moderator: byronnash

Post Reply
ulfstein
Posts: 2
Joined: June 28th, 2009, 3:03 pm

Hi

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
textLayer.text.sourceText.setValue(comp.name);

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

Post Reply