Copy link to clipboard
Copied
I want to convert all text layer into point text. I usually select all text layers, then run the "convert to point text" action. However, not all layers are the same, so paragraph text will convert to point text, and point text will turn to paragraph, they only switch back and forth, but cannot be converted to a unified type (point text).
My file contains a lot of text layers, and I can't check which is point text or paragraph. Because I tried with actions, so I think scripting will be more efficient.
Thank you everyone for help!
Try this (not a very fast script).
function a(layers, kind)
{
try {
for (var i = 0; i < layers.length; i++)
{
if (layers[i].kind == LayerKind.TEXT) layers[i].textItem.kind = kind;
if (layers[i].layers != undefined) a(layers[i].layers, kind);
}
}
catch (e) { alert(e); }
}
a(activeDocument.layers, TextType.POINTTEXT);
Copy link to clipboard
Copied
Hi, did you check this suggested thread on the right? https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-testing-for-point-vs-paragraph...
Copy link to clipboard
Copied
Thank you for your answer! I did, but I have no experient about scripting, so when I tried pixxxelschubser's suggesting, the result was the same as when I used action. By the way, r-bin has solved my problem, I'm satisfied now ^^
Copy link to clipboard
Copied
… so when I tried pixxxelschubser's suggesting, the result was the same as when I used action …
By @Le27921535n6i8
😉
Yes, that was also a different topic seven years ago. At that time, it was essentially about showing how to basically switch from paragraph text to point text and back again with a script.
It was more of a manual than a finished script:
… convert paragraph text to point text (and also in the other direction) is a "destructiv" process …
By @pixxxelschubser
I'm glad your problem has been solved by @r-bin
Copy link to clipboard
Copied
Try this (not a very fast script).
function a(layers, kind)
{
try {
for (var i = 0; i < layers.length; i++)
{
if (layers[i].kind == LayerKind.TEXT) layers[i].textItem.kind = kind;
if (layers[i].layers != undefined) a(layers[i].layers, kind);
}
}
catch (e) { alert(e); }
}
a(activeDocument.layers, TextType.POINTTEXT);
Copy link to clipboard
Copied
Thank you very much, it worked great!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more