Adobe 65010248 Scripting Guide - Page 54
Creating a polygon, Working with enumeration values
UPC - 883919156484
View all Adobe 65010248 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 54 highlights
CHAPTER 6: Scripting with VBScript Working with enumeration values 54 Creating a polygon Consider the following sample: Set appRef = CreateObject("Illustrator.Application") Set frontDocument = appRef.ActiveDocument ' Create a new polygon with ' top = 144, left side = 288, width = 72, height = 144 Set newPolygon = frontDocument.PathItems.Polygon(144,288,72,7) The sample creates a polygon with these properties: ➤ The center point of the object is inset 2 inches (144 points) on the horizontal axis and 4 inches (288 points) on the vertical axis. ➤ The length of the radius from the center point to each corner is 1 inch (72 points). ➤ The polygon has 7 sides. Working with enumeration values Properties that use enumeration values in VBScript use a numeral rather than a text value. For example, the Orientation property of the TextFrame object specifies whether text content in the text frame is horizontal or vertical. The property uses the aiTextOrientation enumeration, which has two possible values, aiHorizontal and aiVertical. To find the numeral values of enumerations, use either of the following: ➤ The object browser in your scripting editor environment. See "Viewing the VBScript object model" on page 9. ➤ The Adobe Illustrator CS4 Scripting Reference: VBScript, which lists the numeral values directly after the constant value in the "Enumerations" chapter at the end of the book. The following example is from that table: Enumeration type AiTextOrientation Values aiHorizontal = 0 aiVertical = 1 What it means The orientation of text in a text frame The following sample specifies vertical text orientation: Set appRef = CreateObject ("Illustrator.Application") Set docRef = appRef.Documents.Add Set textRef = docRef.TextFrames.Add textRef.Contents = "This is some text content." textRef.Left = 50 textRef.Top = 700 textRef.Orientation = 1 Generally, it is considered good scripting practice to place the text value in a comment following the numeral value, as in the following sample statement: textRef.Orientation = 1 ' aiVertical