Adobe 65010248 Scripting Guide - Page 36
Selecting artwork objects, Working with text frames, Threaded frames
UPC - 883919156484
View all Adobe 65010248 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 36 highlights
CHAPTER 4: Scripting with AppleScript Working with text frames 36 Depending on what is selected, the selection property value can be an array of any type of art objects. To get or manipulate the properties of the selected art items, you must retrieve the individual items in the array. To find out an object's type, use the class property. The following sample gets the first object in the array, then displays the object's type: tell application "Adobe Illustrator" set myDoc to current document set selectedObjects to selection of myDoc set topObject to item 1 of selectedObjects display dialog (class of topObject) end tell The first object in a selection array is the selected object that was last added to the page, not the last object selected. Selecting artwork objects To select an art object, the object's selected property. Working with text frames To create a text frame of a specific type in AppleScript, use the kind property of the text frame object: set myRect to make new rectangle in current document with properties {position:{100, 700}, height:100, width:100} set myAreaText to make new text frame in current document with properties {kind:point text,contents:"Text Frame 1"} Threaded frames As in the Illustrator application, you can thread area text frames or path text frames. To thread existing text frames, use the next frame or previous frame property of the text frame object. When copying the following script to your script editor, place the value of the contents property on one line. The long-line character (¬) is not valid within a string value. tell application "Adobe Illustrator" make new document make new rectangle in current document with properties {position:{100, 500}, height:100, width:100} make new text frame in current document with properties {kind:area text, text path:the result, name:"tf1", contents:"This is two text frames linked together as one story, with text flowing from the first to the last. First frame content. "} make new rectangle in current document with properties {position:{300, 700}, height:100, width:100} make new text frame in current document with properties {kind:area text, text path:the result, name:"tf2", contents:"Second frame content." } --use the next frame property to thread the frames set next frame of text frame "tf1" of current document to text frame "tf2" of current document redraw end tell