Separate Layer for each Line of Text
Copy link to clipboard
Copied
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.
Explore related tutorials & articles
Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
@Lumigraphics – Nice!
Now, we both know what the follow-up question is! :]
https://exchange.adobe.com/apps/cc/57bb5a8e/split-rows-for-ps
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
That's what the code from @Lumigraphics does.
Same for the extension in the link in my post.
The code is ExtendScript, to be saved as a plain text file with a .jsx extension. More here:
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
Thanks for the information. I wish to know whether ExtendScript is a Java program.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Is this a separate language or codes to add to Ps to get desired result?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
https://developer.adobe.com/photoshop/
Adobe currently has four frameworks to automate Photoshop.
- Extendscript/ScriptUI
- C++
- CEP
- UXP
And yes, other apps such as Illustrator, InDesign, Acrobat, Bridge, Premiere Pro are also scriptable.
Copy link to clipboard
Copied
What I posted is just a basic outline of what is possible. You could add text formatting, conditions, layer naming, text replacement, all sorts of goodies to that script snippet.

