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

Script testing for Point vs Paragraph text and conversion

Community Beginner ,
Mar 15, 2016 Mar 15, 2016

OK, so i've been beating my head against a wall here for a few days trying to figure out this script. I've come pretty far with it at this point but still a few things I need to work out. I've got the text size conditional worked out  with some help. I've got some good ideas to work out add in some details when my text layers have multiple lines. However, I've noticed my script results differ when I start out with Point vs Paragraph text.

I figure that the best way to combat this is to convert all text to Paragraph text but want to revert text layers that start as Point text back to Point text.

Any ideas?

I've been trying different variations of this:

var doc = activeDocument 

var lay = doc.activeLayer

var textSize = lay.textItem.size

var textlayer = doc.activeLayer

var textHeight = textlayer.bounds[3]-textlayer.bounds[1]

var textWidth = textlayer.bounds[2]-textlayer.bounds[0]

var ogTextType = lay.textItem.kind;

textType = paragraphText;

// Additional Scripting

{//

lay.textType = ogTextType;

TOPICS
Actions and scripting
939
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
Adobe
Community Expert ,
Mar 15, 2016 Mar 15, 2016

Hi timmysmuckers‌,

convert paragraph text to point text (and also in the other direction) is a "destructiv" process.

var aTF = app.activeDocument.activeLayer.textItem;

if (aTF.kind == TextType.PARAGRAPHTEXT) {

    alert ("to point");

    aTF.kind = TextType.POINTTEXT; // but be careful - this will create divis

} else {

    alert ("to paragraph");

    aTF.kind = TextType.PARAGRAPHTEXT;

}

Have fun

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 Beginner ,
Mar 15, 2016 Mar 15, 2016

Thank you, pixxxel schubser

This helps, but I'm not entirely sure this is doing what I need it to do. I get what you are saying about this being destructive.

However, I don't want to convert paragraph to point text at all. This scripting only seems to only convert point text to paragraph text and vice/versa.

What I want to do is:

  1. convert to paragraph text if it isn't already
  2. perform my other tasks
  3. convert text back to point text if that was the original state.

Or am am I missing something? Also, no idea what "divis" means.

Thanks,

Tim

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 Beginner ,
Mar 15, 2016 Mar 15, 2016
LATEST

I've decided to change my approach a bit just to get this solved.

Rather than:

  1. convert to paragraph text if it isn't already
  2. perform my other tasks
  3. convert text back to point text if that was the original state.

I am:

  1. Duplicate original text layer
  2. Convert that to paragraph text if needed.
  3. perform other tasks
  4. delete duplicate of original layer

I did use a bit of your script pixxxel schubser‌, so thank you!

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