Skip to main content
Known Participant
March 15, 2016
Question

Script testing for Point vs Paragraph text and conversion

  • March 15, 2016
  • 1 reply
  • 968 views

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;

This topic has been closed for replies.

1 reply

pixxxelschubser
Community Expert
Community Expert
March 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

Known Participant
March 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