TextFrameItems
TextFrameItems
Section titled “TextFrameItems”app.activeDocument.textFrames
Description
Section titled “Description”The collection of TextFrameItem objects in the document.
Properties
Section titled “Properties”TextFrameItems.length
Section titled “TextFrameItems.length”app.activeDocument.textFrames.length
Description
Section titled “Description”The number of elements in the collection.
Number; read-only.
TextFrameItems.parent
Section titled “TextFrameItems.parent”app.activeDocument.textFrames.parent
Description
Section titled “Description”The object’s container.
Object; read-only.
TextFrameItems.typename
Section titled “TextFrameItems.typename”app.activeDocument.textFrames.typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
Methods
Section titled “Methods”TextFrameItems.add()
Section titled “TextFrameItems.add()”app.activeDocument.textFrames.add()
Description
Section titled “Description”Creates a point text frame item.
Returns
Section titled “Returns”TextFrameItems.areaText()
Section titled “TextFrameItems.areaText()”app.activeDocument.textFrames.areaText(textPath[, orientation][, baseFrame][, postFix])
Description
Section titled “Description”Creates an area text frame item.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
textPath | PathItem | Path item to use |
orientation | TextOrientation, optional | Orientation of text |
baseFrame | TextFrameItem, optional | Text frame to use |
postFix | Boolean, optional | Whether to prefix or postfix the text frame |
Returns
Section titled “Returns”TextFrameItems.getByName()
Section titled “TextFrameItems.getByName()”app.activeDocument.textFrames.getByName(name)
Description
Section titled “Description”Get the first element in the collection with the provided name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | Name of element to get |
Returns
Section titled “Returns”TextFrameItems.index()
Section titled “TextFrameItems.index()”app.activeDocument.textFrames.index(itemKey)
Description
Section titled “Description”Gets an element from the collection.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
itemKey | String, Number | String or number key |
Returns
Section titled “Returns”TextFrameItems.pathText()
Section titled “TextFrameItems.pathText()”app.activeDocument.textFrames.pathText(textPath[,startTValue][,endTValue][, orientation][, baseFrame][, postFix])
Description
Section titled “Description”Creates an on-path text frame item.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
textPath | PathItem | Path item to use |
startTValue | Number (double) | Start position of text along the path |
endTValue | Number (double) | End position of text along the path |
orientation | TextOrientation, optional | Orientation of text |
baseFrame | TextFrameItem, optional | Text frame to use |
postFix | Boolean, optional | Whether to prefix or postfix the text frame |
Returns
Section titled “Returns”TextFrameItems.pointText()
Section titled “TextFrameItems.pointText()”app.activeDocument.textFrames.pointText(anchor[, orientation])
Description
Section titled “Description”Creates a point text frame item.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
anchor | Array of 2 numbers | Point text anchor |
orientation | TextOrientation, optional | Orientation of text |
Returns
Section titled “Returns”TextFrameItems.removeAll()
Section titled “TextFrameItems.removeAll()”app.activeDocument.textFrames.removeAll()
Description
Section titled “Description”Deletes all elements in this collection.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Creating and modifying text frames
Section titled “Creating and modifying text frames”// 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 documentvar docRef = documents.add();
// create 3 new textFrames (area, line, point)// Area Textvar rectRef = docRef.pathItems.rectangle(700, 50, 100, 100); var areaTextRef = docRef.textFrames.areaText(rectRef); areaTextRef.contents = "TextFrame #1";areaTextRef.selected = true;
// Line Textvar 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 Textvar pointTextRef = docRef.textFrames.add(); pointTextRef.contents = "TextFrame #3"; pointTextRef.top = 700;pointTextRef.left = 400; pointTextRef.selected = true; redraw();
// count the TextFramesvar 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;