Skip to main content
MahaB82A
Legend
February 5, 2024
Question

Separate Layer for each Line of Text

  • February 5, 2024
  • 1 reply
  • 893 views

In this all four text are in one layer. Is there any tool to separte this four text into each separte layer? That means one text is in one layer.  Four texts are in four separate layers independently

 

 

 

This topic has been closed for replies.

1 reply

Legend
February 5, 2024

So your original has one text layer with four lines?

You can use a script to separate these out. These are the basic steps.

try{
    var docRef = app.activeDocument;
    var LayerRef = docRef.activeLayer;
    if(LayerRef.kind == LayerKind.TEXT){
        var LayerText = LayerRef.textItem.contents;
        LayerText = LayerText.split('\r');
        LayerRef.remove();
        for(var i = 0; i < LayerText.length; i++){
            LayerRef = docRef.artLayers.add();
            LayerRef.kind = LayerKind.TEXT;
            TextRef = LayerRef.textItem;
            TextRef.contents = LayerText[i];
            }
        }
    }
catch(e){
    Window.alert(e + ' ' + e.line);
    }

 

Stephen Marsh
Community Expert
Community Expert
February 6, 2024

@Lumigraphics – Nice!

 

Now, we both know what the follow-up question is!  :]

 

https://exchange.adobe.com/apps/cc/57bb5a8e/split-rows-for-ps