I'd like to run a code based on the length or height(Paragraphs) of a text string. Is there one for figuring out the text length or height, something like if(TextString.length > TextString.height)
I found this code for determining the canvas width or height,I'd like to have one for text string:
Code: Select all if(myDoc.width > myDoc.height)
{
Do something
}
else
{
Do something
}
Detecting Text Length and Height
-
Mike Hale
Detecting Text Length and Height
If you get the bounds of the text layer that will give you the width and height of the text in a ruler unit such as pixels, pts, in, etc.
-
mycort
Detecting Text Length and Height
you mean this code here?
Code: Select all var x = doc.activeLayer.bounds[0]
var y = doc.activeLayer.bounds[1]
so something like this?
Code: Select all ( doc.activeLayer.bounds[0] > doc.activeLayer.bounds[1])
Code: Select all var x = doc.activeLayer.bounds[0]
var y = doc.activeLayer.bounds[1]
so something like this?
Code: Select all ( doc.activeLayer.bounds[0] > doc.activeLayer.bounds[1])
-
Mike Hale
Detecting Text Length and Height
Code: Select allvar b = app.activeDocument.activeLayer.bounds;
var width = b[2]-b[0];
var height = b[3]-b[1];
var width = b[2]-b[0];
var height = b[3]-b[1];