Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Convert all text into point text script?

Explorer ,
Feb 05, 2023 Feb 05, 2023

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!

TOPICS
Actions and scripting , Windows
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Feb 05, 2023 Feb 05, 2023

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

 

 

Translate
Adobe
Community Expert ,
Feb 05, 2023 Feb 05, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 05, 2023 Feb 05, 2023

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 ^^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2023 Feb 05, 2023
LATEST
quote

… 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:

quote

… 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 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 05, 2023 Feb 05, 2023

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

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 05, 2023 Feb 05, 2023

Thank you very much, it worked great!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines