Adobe 65010248 Scripting Guide - Page 37
Threaded frames make one story object, Creating paths and shapes, Paths
UPC - 883919156484
View all Adobe 65010248 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 37 highlights
CHAPTER 4: Scripting with AppleScript Creating paths and shapes 37 Threaded frames make one story object Threaded frames make a single story object. To observe this, run the following AppleScript after running the script in "Threaded frames" on page 36. display dialog ("There are " & (count(text frames of current document)) & " text frames.") display dialog("There are " & (count(stories of current document)) & " stories.") Creating paths and shapes This section explains how to create items that contain paths. Paths To create line or a freeform path, specify a series of path points, as a series of x-y coordinates or path point objects. Using x-y coordinates limits the path to straight segments. To created a curved path, you must create path point objects. A path can comprise a combination of page coordinates and path point objects. Specifying a series of x-y coordinates To specify a path using page-coordinate pairs, use the entire path property of the path items object. The following script specifies three pairs of x-y coordinates, to create a path with three points: tell application "Adobe Illustrator" set docRef to make new document -- set stroked to true so we can see the path set lineRef to make new path item in docRef with properties {stroked:true} set entire path of lineRef to {{220, 475},{200, 300},{375, 300}} end tell Using path point objects To create a path point object, you must define three values for the point. ➤ A fixed anchor point, which is the point on the path. ➤ A pair of direction points-left direction and right direction-which allow you to control the path segment's curve. You define each property as an array of page coordinates in the format [x, y]: ➤ If all three properties of a path point object have the same coordinates, and the properties of the next path point in the line are equal to each other, you create a straight-line segment. ➤ If two or more properties in a path point object have different values, the segment connected to the point is curved. To create a path or add points to an existing path using path point objects, create a path item object, then add the path points as child objects in the path item: