Can a script determine number of lines in a paragraph?
I found the exact same question in the InDesign scripting, but there is no such question in the photoshop scripting.
Generally, I have a textitem that I created in the script. I set up the length is 200px cause I know it would be the maximum. But generally I don't know how many lines are there. I need to know the total number of lines is because I will add extra textitem. By determine the height of my words, I would not overlay other textitems.
This is what I have so far.
if (app.activeDocument.activeLayer.kind == LayerKind.TEXT){
var textItemRef = app.activeDocument.activeLayer.textItem;
var content = textItemRef.contents; //<--- the contents is already set up.
textItemRef.contents = content.substring(1);
//3. fix it to the paragraph
textItemRef.kind = TextType.PARAGRAPHTEXT;
textItemRef.width = UnitValue(150,"px");
textItemRef.height = UnitValue(200,"px");
var just = Justification.LEFT;
activeDocument.activeLayer.textItem.justification = just;
//4. fixed to the correct location
textItemRef.position = new Array(pos[0], pos[1] );
//5. should return lines number
return textItemRef.lines??????
Thanks in advance!
