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);
    }

 

MahaB82A
MahaB82AAuthor
Legend
February 6, 2024

Thanks for the reply. This seems a program. I do not know how to use this. If it is frequently used in Ps I am prepared to learn this. Anyway I solved this problem by writing each text in four separate layer.

 

But if it is a very long text it is tedious to make many separate layer, in such a case program is useful. 

 

What I was looking for was any tool or command to make one long sentence in one layer into each text in many layers.   

 

MahaB82A
MahaB82AAuthor
Legend
February 7, 2024

@MahaB82A wrote:

Thanks for the information. I wish to know whether ExtendScript is a Java program. 



An extended/custom form of an old JavaScript language version, not Java program code which is something totally different.


Is this a separate language or codes to add to Ps to get desired result?