Skip to main content
Participant
May 7, 2016
Answered

Retain layer names when outlining text

  • May 7, 2016
  • 1 reply
  • 941 views

I would like to know if there is a way to retain the names of text objects/layers when the text is converted to outlines, using scripting.

I create files with dozens of text layers (player names on the back of sports jerseys) and have to send the .ai file to the manufacturers. This means that I have to outline the text, but when I do so, the layers all lose their names and all become "<Group>".

Can anyone think of a way to name these layers with the text they contain?

This topic has been closed for replies.
Correct answer pixxxelschubser

Hi openbracket​,

it's impossible, if the text is outlined.

But it is possible for text and outline the text through script (be sure that the selected text is only filled and without stroke and/or effects)

You can try something like this:

// required: an opened document with one selected text frame

var aDoc = app.activeDocument;

var aSel = aDoc.selection;

if (aSel[0].typename =="TextFrame") {

    if (aSel[0].characters.length < 40) {

    var newName = aSel[0].contents;

    } else {

    newName = aSel[0].contents.substr(0, 39);

    }

aSel[0].createOutline();

aSel = aDoc.selection;

// name of the new Group = contents or part of contents of selected text frame

aSel[0].name = newName;

}

Have fun

1 reply

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
May 7, 2016

Hi openbracket​,

it's impossible, if the text is outlined.

But it is possible for text and outline the text through script (be sure that the selected text is only filled and without stroke and/or effects)

You can try something like this:

// required: an opened document with one selected text frame

var aDoc = app.activeDocument;

var aSel = aDoc.selection;

if (aSel[0].typename =="TextFrame") {

    if (aSel[0].characters.length < 40) {

    var newName = aSel[0].contents;

    } else {

    newName = aSel[0].contents.substr(0, 39);

    }

aSel[0].createOutline();

aSel = aDoc.selection;

// name of the new Group = contents or part of contents of selected text frame

aSel[0].name = newName;

}

Have fun

Participant
May 7, 2016

Wow, thanks for that pixxxel schubser​. I think I can tell what's going on in there. I'll give it a go!