Skip to content

TextFrameItems

app.activeDocument.textFrames

The collection of TextFrameItem objects in the document.


app.activeDocument.textFrames.length

The number of elements in the collection.

Number; read-only.


app.activeDocument.textFrames.parent

The object’s container.

Object; read-only.


app.activeDocument.textFrames.typename

The class name of the referenced object.

String; read-only.


app.activeDocument.textFrames.add()

Creates a point text frame item.

TextFrameItem


app.activeDocument.textFrames.areaText(textPath[, orientation][, baseFrame][, postFix])

Creates an area text frame item.

ParameterTypeDescription
textPathPathItemPath item to use
orientationTextOrientation, optionalOrientation of text
baseFrameTextFrameItem, optionalText frame to use
postFixBoolean, optionalWhether to prefix or postfix the text frame

TextFrameItem


app.activeDocument.textFrames.getByName(name)

Get the first element in the collection with the provided name.

ParameterTypeDescription
nameStringName of element to get

TextFrameItem


app.activeDocument.textFrames.index(itemKey)

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

TextFrameItem


app.activeDocument.textFrames.pathText(textPath[,startTValue][,endTValue][, orientation][, baseFrame][, postFix])

Creates an on-path text frame item.

ParameterTypeDescription
textPathPathItemPath item to use
startTValueNumber (double)Start position of text along the path
endTValueNumber (double)End position of text along the path
orientationTextOrientation, optionalOrientation of text
baseFrameTextFrameItem, optionalText frame to use
postFixBoolean, optionalWhether to prefix or postfix the text frame

TextFrameItem


app.activeDocument.textFrames.pointText(anchor[, orientation])

Creates a point text frame item.

ParameterTypeDescription
anchorArray of 2 numbersPoint text anchor
orientationTextOrientation, optionalOrientation of text

TextFrameItem


app.activeDocument.textFrames.removeAll()

Deletes all elements in this collection.

Nothing.


// Creates a document with text frames displaying path, area and point
// text, changes the content of each frame then deletes the 2nd frame
// create a new document
var docRef = documents.add();
// create 3 new textFrames (area, line, point)
// Area Text
var rectRef = docRef.pathItems.rectangle(700, 50, 100, 100); var areaTextRef = docRef.textFrames.areaText(rectRef); areaTextRef.contents = "TextFrame #1";
areaTextRef.selected = true;
// Line Text
var lineRef = docRef.pathItems.add();
lineRef.setEntirePath( Array(Array(200, 700), Array(300, 550) ) ); var pathTextRef = docRef.textFrames.pathText(lineRef); pathTextRef.contents = "TextFrame #2";
pathTextRef.selected = true;
// Point Text
var pointTextRef = docRef.textFrames.add(); pointTextRef.contents = "TextFrame #3"; pointTextRef.top = 700;
pointTextRef.left = 400; pointTextRef.selected = true; redraw();
// count the TextFrames
var iCount = docRef.textFrames.length;
var sText = "There are " + iCount + " TextFrames.\r" sText += "Changing contents of each TextFrame.";
// change the content of each docRef.textFrames[0].contents = "Area TextFrame."; docRef.textFrames[1].contents = "Path TextFrame."; docRef.textFrames[2].contents = "Point TextFrame."; redraw();
docRef.textFrames[1].remove(); redraw();
// count again
var iCount = docRef.textFrames.length;