Skip to main content
Participant
May 1, 2024 4:03 PM UTC
Question

How to change the value of text fields in layers

How to change the value of text fields in R_VAR layers
each BLOCK_nn composition located in ALL_BLOCKS of the main “MAIN” composition with data from an external file
“export-data.txt”?

Tried some variations of scripts - all do not work properly.

Even command
app.project.itemByName("BLOCKS_01") - undefined

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Dan Ebberts
Community Expert
Community Expert
May 1, 2024 4:55 PM UTC

I'm not sure what the issue is, but this works for me:

function getComp(theName){
	for (var i = 1; i <= app.project.numItems; i++){
		if (app.project.item(i) instanceof CompItem && app.project.item(i).name == theName){
			return app.project.item(i);
		}
	}
	return null;
}
var myComp = getComp("BLOCK_01");
if (myComp){
	var myTextDoc = myComp.layer("R_VAR").property("ADBE Text Properties").property("ADBE Text Document").value;
	myTextDoc.text = "New Text";
	myComp.layer("R_VAR").property("ADBE Text Properties").property("ADBE Text Document").setValue(myTextDoc);
}else{
	alert("Can't find comp 'BLOCK_01'");
}
Translate
Mathias Moehl
Community Expert
Community Expert
May 1, 2024 4:53 PM UTC

If you want to create your own tool with my (paid) extension Automation Blocks,

learn here, how to modify things like texts in your project:
https://docs.mamoworld.com/automation-blocks/tutorials-ae/writeCustomTemplateTool

instead of using a custom user interface, you want to read the data from a spreadsheet.
You can learn here, how to work with spreadsheet files in Automation Blocks:

https://docs.mamoworld.com/automation-blocks/tutorials-pr/mogrtFromSpreadsheet

The latter tutorial is for Premiere Pro, but the blocks to work with spreadsheets are identical in both Ae and Pr.

 

Translate
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects