
C
HAPTER
4: Scripting with AppleScript
Creating paths and shapes
39
Write-once access
Properties for path-item shapes use the “write-once” access status, which indicates that the property is
writeable only when the object is created. For existing path-item objects, the properties are read-only
properties whose values cannot be changed.
Creating a rectangle
Consider the following sample:
tell application "Adobe Illustrator"
set docRef to make new document
set rectRef to make new rectangle in docRef with properties
{bounds:{288, 360, 72, 144}}
end tell
The sample creates a rectangle with these properties:
➤
The top-right corner of the of the rectangle is inset 4 inches (288 points) from the bottom of the page
and 5 inches (360 points) from the left edge of the page.
➤
The lower-left corner of the rectangle is inset 1 inch (72 points) from the left edge of the page and
2 inches (144 points) from the bottom of the page.
Creating a polygon
Consider the following sample:
tell application "Adobe Illustrator"
set docRef to make new document
set pathRef to make new polygon in docRef with properties
{center point:{144, 288},sides:7,radius:72.0}
end tell
The sample creates a polygon with these properties:
➤
The center point of the object is inset is 2 inches (144 points) on the horizontal axis and 4 inches
(288 points) on the vertical axis.
➤
The polygon has 7 sides.
➤
The length of the radius from the center point to each corner is 1 inch (72 points).