Skip to main content
Participant
July 21, 2022
Question

Update text object to match text layer name?

  • July 21, 2022
  • 1 reply
  • 349 views

Looking for a way to (hopefully in mass) update a text object on the artboard (eg "101") to match its corresponding name in the layers panel after I change it (eg "101,A1")

So the text object on the artboard is "101" and I change the layer name to "101,A1", I am looking for a way to update the text object to "101,A1", without manually typing it into the text object.

Any scripts out there?

This topic has been closed for replies.

1 reply

rcraighead
Legend
July 21, 2022

This would update any text frame contents in the active document to it's object name:

updateContent();

function updateContent() {
    var aDoc = app.activeDocument;
    for (i = 0; i < aDoc.textFrames.length; i++) {
        aDoc.textFrames[i].contents = aDoc.textFrames[i].name;
    }
}