Skip to main content
MahaB82A
February 5, 2024
Question

Separate Layer for each Line of Text

  • February 5, 2024
  • 1 reply
  • 916 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
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
February 7, 2024

@MahaB82A wrote:

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


 

Both!

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html


If it is a separate language I am willing to learn then I can understand the codes added to Ps. Is this codes can be added to other adobe apps [Pr, Ae and Ai]?

 

Do you know any resources where I can learn this language from scratch?