Adobe 26001360 - Illustrator CS - PC Manual
Adobe 26001360 - Illustrator CS - PC Manual

Adobe 26001360 - Illustrator CS - PC Manual

Scripting guide
Hide thumbs Also See for 26001360 - Illustrator CS - PC:
Table of Contents

Advertisement

Quick Links

Adobe Illustrator CS
Scripting Guide
a
August 12, 2003
Adobe Developer Support
345 Park Avenue
San Jose, CA 95110-2704
408-536-9000
FaxYI: 206-628-5737
ada@adobe.com
http://partners.adobe.com
Europe:
PO Box 12356
Edinburgh EH11 4GJ
United Kingdom
+44.131.458.6800
Fax: +44.131.458 6801
euroADA@adobe.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 26001360 - Illustrator CS - PC and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Adobe 26001360 - Illustrator CS - PC

  • Page 1 Adobe Illustrator CS Scripting Guide August 12, 2003 Adobe Developer Support Europe: 345 Park Avenue PO Box 12356 San Jose, CA 95110-2704 Edinburgh EH11 4GJ 408-536-9000 United Kingdom FaxYI: 206-628-5737 +44.131.458.6800 ada@adobe.com Fax: +44.131.458 6801 euroADA@adobe.com http://partners.adobe.com...
  • Page 2 Adobe, the Adobe logo, Adobe Acrobat, Adobe Photoshop, Adobe Illustrator, Adobe InDesign, and PostScript are trademarks of Adobe Systems Incorporated that may be registered in certain jurisdictions. Macintosh and Apple are registered trademarks, and Mac OS and AppleScript are trademarks of Apple Computer, Inc. Microsoft, Visual Basic, Windows, Windows 95, Windows 98, and Windows NT are registered trademarks of Microsoft Corporation.
  • Page 3: Table Of Contents

    Contents Chapter 1: Introduction........13 About this manual .
  • Page 4 Chapter 3: Scripting Illustrator ....... . 33 Illustrator’s object model .........33 Looking at Illustrator’s objects and commands .
  • Page 5 Adobe Illustrator CS Scripting Guide User Interaction Levels......... . .59 AppleScript .
  • Page 6 Illustrator save options......... . 125 ink.
  • Page 7 Adobe Illustrator CS Scripting Guide rounded rectangle ..........212 screen properties .
  • Page 8 viii exists ........... . . 259 export .
  • Page 9 Adobe Illustrator CS Scripting Guide Brush ........... . . 295 Brushes .
  • Page 10 Lines ........... . . 364 Matrix .
  • Page 11 Adobe Illustrator CS Scripting Guide RasterItem ..........429 RasterItems .
  • Page 12 Adobe Systems, Inc........
  • Page 13: Chapter 1: Introduction

    Introduction About this manual This manual provides an introduction to scripting Adobe® Illustrator® CS on Mac OS 10 and Windows. Since not every Illustrator user will be familiar with programming terms, concepts, and techniques, so we’ve included Chapter 2, “Scripting Basics, ” which contains introductory information that should help get you started with scripting.
  • Page 14: What Is Scripting

    Introduction What is scripting? A script is a series of commands that tells Illustrator to perform a series of actions. These actions can be simple, and affect only a single, selected object in the current document; or complex, and affect all of the objects in all of your Illustrator documents. The actions might involve only Illustrator, or they might involve other applications, such as word processors, spreadsheets, and database management programs.
  • Page 15: What About Actions

    You record, play, edit and delete actions using Illustrator’s built-in Actions palette. The “Automating Tasks” chapter in the Adobe Illustrator User Guide covers actions in detail. With the introduction of scripting for Illustrator, it is important to avoid any confusion about the difference between actions and scripting.
  • Page 16: Mac Os

    Introduction Mac OS To write scripts on Mac OS, you must have Mac OS X 10.2. You will also need AppleScript and a script editor installed. AppleScript and the Script Editor application from Apple come installed on all supported versions of Mac OS. As your scripts become more complex, you may find the need for debugging and productivity features not found in Script Editor.
  • Page 17: Chapter 2: Scripting Basics

    Scripting Basics If you use Illustrator, then you work with documents and their contents. You create documents, layers, colors, and design elements. If you do all of this, you’ve probably gotten used to thinking of an Illustrator document as a series of objects. Automating Illustrator with scripting uses the same object-oriented way of thinking.
  • Page 18: Object Classes

    Object model concepts Your house can also contain other objects. Just like your house can contain other objects, the objects within the house can also contain a number of smaller objects. Each room, for example, is an object in the house, while each window, door, or appliance is an object inside of the room. Each object can respond to various commands according to its capabilities.
  • Page 19: Object Elements Or Collections

    Adobe Illustrator CS Scripting Guide number of panes property which the opening class doesn’t. In Illustrator, path items, for example, have the property stroke color which isn’t inherited from the page item class. Object elements or collections Object elements (AppleScript) or collections (Visual Basic) are objects contained within other objects.
  • Page 20: About Long Script Lines

    Scripting concepts valuable help when the script is modified at a later date. The time you save later trying to figure out what the script does may be your own. Comments are ignored by the scripting system as the script executes and cause no run-time speed penalty. AppleScript To enter a single-line comment in an AppleScript, type “--”...
  • Page 21: Values Types

    Adobe Illustrator CS Scripting Guide Values Types Values are the data your scripts use to do their work. Most of the time, the values used in your scripts will be numbers or text. The value types are shown in the following tables.
  • Page 22: Variables

    Scripting concepts Variables Variables are containers for data. A variable might contain a number, a string, a list (or array), or an object reference. Variables have names, and you refer to a variable by its name. To put data into a variable, we assign the data to the variable. The file name of the current Illustrator document or the current date are both examples of data that can be assigned to a variable.
  • Page 23: Properties

    Adobe Illustrator CS Scripting Guide newly created object. Storing references in variables is just the same as assigning any other value to the variable. set thisLayer to make new layer at beginning of document 1 or you can fill the variable with a reference to an existing object: set thisLayer to layer 1 of document 1 Visual Basic works similarly, however, there is an important distinction to note.
  • Page 24: Operators

    Scripting concepts Operators Operators perform calculations (addition, subtraction, multiplication, and division) on variables or values and return a result. For example: docWidth/2 would return a value equal to half of the content of the variable docWidth. So if docWidth contained the number 20.5, the value returned would be 10.25. You can also use operators to perform comparisons (equal to, not equal to, greater than, or less than).
  • Page 25: Conditional Statements

    Adobe Illustrator CS Scripting Guide Visual Basic In Visual Basic, use the Add method to create new objects, the Set statement to assign object references to Visual Basic variables or properties, the assignment operator ( = ) to retrieve and change object properties.
  • Page 26 Scripting concepts for repetitive processes, or “loops.” The idea of a loop is to repeat some action over and over again, with or without changes each time through the loop, until some condition is met. Both AppleScript and Visual Basic have a variety of different control structures to choose from. The simplest form of a loop is one that repeats some series of script operations a set number of times.
  • Page 27: Handlers And Subroutines

    Adobe Illustrator CS Scripting Guide Handlers and subroutines Handlers (in AppleScript) or subroutines (in Visual Basic) are scripting modules you can refer to from within your script. Handlers and subroutines are ways to re-use parts of scripts. Typically, you send one or more values to a handler (or subroutine), and it returns one or more values.
  • Page 28 Scripting concepts Visual Basic Private Sub Command1_Click() ' Calculate the geometric center of a selected art item ' Assumes you have a single art item selected Dim appRef As New Illustrator.Application Dim selectedObjects As Variant Dim objectBounds As Variant Dim objectCenter As Variant If appRef.Documents.Count >...
  • Page 29: Testing And Troubleshooting

    Adobe Illustrator CS Scripting Guide Testing and troubleshooting Both scripting environments provide tools for monitoring the progress of your script while it is running—which make it easier for you to track down any problems your script might be encountering or causing.
  • Page 30 Testing and troubleshooting In addition, the Result window (choose Controls > Show Result) will display the value from the last script statement evaluated. Third-party editors offer additional debugging features. Visual Basic In Visual Basic, you can stop your script at any point, or step through your script one line at a time.
  • Page 31: About Error Handling

    Adobe Illustrator CS Scripting Guide values of variables defined in your script using the Watch window—a very valuable tool for debugging your scripts. To view a variable in the Watch window, select the variable and choose Debug > Quick Watch. Visual Basic displays the Quick Watch dialog box. Click the Add button.
  • Page 32 --Store a reference to the fifth path item of the document in a variable --If the object does not exist in the current document, display a message tell application "Adobe Illustrator CS" activate set itemCount to count of path items in current document...
  • Page 33: Chapter 3: Scripting Illustrator

    Scripting Illustrator At this point, you should have a good idea of what scripting is and how it works. We are ready to begin looking at scripting Adobe Illustrator. Illustrator’s object model A good understanding of Illustrator’s object model will improve your scripting abilities.
  • Page 34: Looking At Illustrator's Objects And Commands

    Scripting Illustrator Figure 3.1 Adobe Illustrator Scripting Object Model Application Document Page Item Layer Compound Text Font Path Item Group Item Path Item Graph Item Brush Graphic Style Mesh Item Path Point Path It Spot Paragraph Style Placed Item View...
  • Page 35 Adobe Illustrator CS Scripting Guide 3. Find and then select the Illustrator application and click the OK button. Script Editor displays a list of Illustrator’s objects and commands. You’ll also be able to see the properties and elements associated with each object, as well as the parameters for each command.
  • Page 36: Visual Basic

    Tools References 2. Turn on the “Adobe Illustrator CS Type Library” option from the list of available references and click the OK button. If the library does not appear in the list of available references, reinstall Illustrator with your scripting plug-ins.
  • Page 37: Your First Illustrator Script

    To create a Visual Basic script follow these steps: 1. Start Visual Basic and create a new project. Add the “Adobe Illustrator CS ?? Type Library” reference to the project, as shown earlier. If you are using a built-in editor in a VBA application, skip to step 4.
  • Page 38 Scripting Illustrator 4. Enter the following code. The lines which begin with a single quote character (‘) are comments, and will be ignored by the scripting system. They’re included to describe the operation of the script. As you look through the script, you’ll see how we create, then address each object in turn.
  • Page 39: Vbscript

    Adobe Illustrator CS Scripting Guide 8. Run the script. Illustrator will create a new document, add a text frame item at the specified position, and set the text to “Hello World!”. VBScript You don’t need to use Visual Basic to run scripts on Windows. Another way to script Illustrator is to use a VBA editor (such as the one that is included in Microsoft Word) or to use Windows Scripting Host.
  • Page 40: Adding Features To "Hello World

    Scripting Illustrator In VBScript you must use integer values instead of the enumeration. (See the “Enumerations reference” section in “Visual Basic Reference” on page 287 to find the values that correspond to the various enumerations.) The corresponding VBScript is: Dim appRef Set appRef = CreateObject("Illustrator.Application") appRef.ActiveDocument.Close ( 2 ) Here is an example of Hello World! for VBScript:...
  • Page 41 Adobe Illustrator CS Scripting Guide 3. Resize the text frame item to match the document’s width. Adding features to the AppleScript script To create the enhanced script follow these steps: 1. Choose > to create a new script. File New in Script Editor 2.
  • Page 42: Measurement Units

    2 inches to the right of, and 6 inches above, its current position, you’d use the following script in AppleScript: tell application "Adobe Illustrator CS" (* first, manually select the text frame item from the previous exercise or use AppleScript to make the...
  • Page 43: Unit Conversion To Points

    Adobe Illustrator CS Scripting Guide If TypeName(selectedObjects) = "Variant()" Then For Each objectRef In selectedObjects There are 72 points per inch, so the following will move the 'object 2" to the right and 6" up objectRef.Translate 144, 226 Next End If...
  • Page 44: Coordinates

    Scripting Illustrator Coordinates Illustrator uses simple two-dimensional geometry to record the position of objects in a document. The coordinates used in Illustrator are the same as the “traditional” geometric coordinate system you learned about in school. The horizontal component of a coordinate pair (or “point”) is referred to as “x”...
  • Page 45: Fixed Rectangle

    Adobe Illustrator CS Scripting Guide Fixed rectangle To work with rectangular coordinates where there are a pair of x and y values, Illustrator uses the special class called a fixed rectangle. This class consists of a list with four items in AppleScript, and a variant array with four elements in Visual Basic.
  • Page 46: Object References

    Scripting Illustrator position Position control bounds ControlBounds visible bounds VisibleBounds geometric bounds GeometricBounds page origin Detail PageOrigin (0,0) Every page item also has three properties that describe the object’s overall extent using fixed rectangles. The geometric bounds (GeometricBounds in Visual Basic) of a page item are the rectangular dimensions of the object excluding stroke width.
  • Page 47: Object References In Visual Basic

    Adobe Illustrator CS Scripting Guide Therefore, any references made to path item 1 of layer 2 of document 1 will refer to the new object. Consider the following sample script. -- Make 2 new objects and try to select both tell application "Adobe Illustrator CS"...
  • Page 48: Object Containment: Document Vs. Layer

    The following scripts demonstrate how to reference an object as part of a document. In AppleScript: -- Get reference for first page item of document 1 tell application "Adobe Illustrator CS" set pageItemRef to page item 1 of document 1 end tell 12 Aug 03...
  • Page 49: Working With Selections

    Adobe Illustrator CS Scripting Guide In Visual Basic: Private Sub Command1_Click() 'Get reference for first page item of document 1 Dim appRef As New Illustrator.Application Dim documentRef As Illustrator.Document Dim pageItemRef As Illustrator.PageItem Set documentRef = appRef.ActiveDocument Set pageItemRef = documentRef.PageItems(1)
  • Page 50 Scripting Illustrator In AppleScript: --selection sorter tell application "Adobe Illustrator CS" set selectedObjects to selection if selectedObjects is {} then display dialog "No objects are selected" else if class of selectedObjects = list and ¬ (count of items in selectedObjects > 1) then --selection contains more than one object.
  • Page 51 Adobe Illustrator CS Scripting Guide In Visual Basic: 'Selection sorter Private Sub Command1_Click() Dim appRef As New Illustrator.Application Dim documentRef As Illustrator.Document Set documentRef = appRef.ActiveDocument selectedObjects = documentRef.Selection If TypeName(selectedObjects) = "String" Then 'text is selected Else 'Is anything selected?
  • Page 52: Working With Paths

    For more information on working with paths, Bézier curves, and path points, refer to the Illustrator Plug-in Software Development Kit Function Reference. This document is available as part of the Illustrator Software Development Kit (SDK), which can be downloaded from the Adobe Solutions Network (ASN) web site: http://partners.adobe.com/asn/developer/sdks.html Working with color Swatches can be created and manipulated from your scripts.
  • Page 53: Working With Symbols

    Scripting Illustrator during this conversion. Refer to the “Applying Color” chapter in the Adobe Illustrator User Guide for more information on working with color. Working with symbols Symbols are art objects that are stored in the Symbols palette and applied to documents.
  • Page 54 There are special sets of text ranges within a text range that have semantic meanings such as paragraphs, lines, words, characters. There are three types of text frame items in Adobe Illustrator: point text, path text, and area text. The kind property (Kind in Visual Basic) of a text frame item is used to determine the type of the text frame item.
  • Page 55: Content Of A Text Range

    Scripting Illustrator Content of a Text Range You can set the content of a text range by passing in a Unicode string known to that particular scripting language. If you know the Unicode value of a character, you can enter it using a C language style backslash escape sequence .
  • Page 56: Transformation Matrices

    Scripting Illustrator When printing, you may provide an options parameter to more fully control the printing process. Illustrator CS supports an extensive list of new printing options, all of which have default values. As a scripter, you can override any one of these printing options. If you do not override those printing options or if you override those printing options with illegal values (such as specifying a printer or paper that does not exist), an error will be returned.
  • Page 57: Using A Matrix In An Applescript Script

    (* This script gets the identity matrix, combines it with a rotation matrix and a scale matrix and then applies the resulting matrix to all page items. *) tell application "Adobe Illustrator CS" set transformationmatrix to get identity matrix set transformationmatrix to concatenate rotation matrix ¬...
  • Page 58: Working With Variables And Datasets

    Scripting Illustrator Set frontDocument = appRef.ActiveDocument For Each artItem In frontDocument.PageItems artItem.Transform totalMatrix Next End Sub A matrix object in Illustrator consists of six properties. In AppleScript, these properties are: mvalue_a, mvalue_b, mvalue_c, mvalue_d, mvalue_tx, and mvalue_ty. In Visual Basic, these properties are: MValueA, MValueB, MValueC, MValueD, MValueTX, and MValueTY.
  • Page 59: Launching And Quitting From Visual Basic

    Scripting Illustrator show a dialog asking if the data on the clipboard should be saved for other applications. You can avoid this dialog by clearing the clipboard with the statement: set the clipboard to {} Launching and quitting from Visual Basic In Visual Basic, the Activate method will bring the Illustrator application to the front if it is not already frontmost.
  • Page 60: Applescript

    Scripting Illustrator interaction is normally suppressed in an automation environment, and some interaction might be useful where scripts are being used in a more interactive fashion. AppleScript There are four possible values for the user interaction level property in AppleScript: Property Value Result never interact...
  • Page 61: Notes

    Adobe Illustrator CS Scripting Guide Notes If there is an error encounter during script execution an error dialog will be displayed containing the error message returned by the script. It is not possible to execute scripts that contain the do script (DoScript in Visual Basic) command from the Scripts menu.
  • Page 62: Executing Other Scripts

    Scripting Illustrator Note: Because of a limitation in the Mac OS, there is a limit of 4 levels of nested sub-folders inside the Scripts folder for the Mac OS version of Illustrator. Executing other scripts A Browse item is provided at the end of the Scripts menu (File > Scripts > Browse…) which allows you to execute scripts which are not installed in the Scripts folder.
  • Page 63: Chapter 4: Applescript Reference

    AppleScript Reference This reference section describes the objects and commands in Illustrator’s AppleScript dictionary. All of the objects in the dictionary are presented alphabetically. Following the object classes is the section “Command reference” on page 245—which lists all of the commands in the Illustrator dictionary. Each object listing includes the following: •...
  • Page 64: Application

    AppleScript Reference application The Adobe Illustrator application object, which contains all other Illustrator objects. Table 4.1 application — Elements Element: Refer to by: name, index, before/after, range, test document name, index, before/after, range, test font Table 4.2 application — Properties...
  • Page 65 • interact with all commands • interact with local Default: interact with all • interact with self • never interact The version of the Adobe Illustrator version Unicode text application Valid Commands • activate • launch • paste •...
  • Page 66 Use set the selection to in place of select. -- Select the first object in the document tell application "Adobe Illustrator CS" -- Make sure there is a page item to select if (document 1 exists) and (page item 1 of document 1 exists) then...
  • Page 67: Brush, Brushes

    Adobe Illustrator CS Scripting Guide brush, brushes A brush or list of brushes. Brushes are contained in documents. Table 4.3 brush, brushes — Properties Property Value type What it is The best type for the brush object’s best type type class value;...
  • Page 68 AppleScript Reference -- Check for selection of single non-text object if class of selectedItems is text or (count items of selectedItems) is not 1 then display dialog "Select a single path item before running this script" else tell application "Illustrator CS" set pathItem to item 1 of selectedItems -- Get the item's position and use it to tile the new items below set {itemX, itemY} to position of pathItem...
  • Page 69: Character

    Adobe Illustrator CS Scripting Guide character Specifies the properties of a character. Table 4.4 Character — Elements Elements Refer to by by name, by numeric index, as a range of elements, before/after another character style element, satisfying a test by numeric index, as a range of elements, before/after another element,...
  • Page 70 AppleScript Reference Table 4.5 Character — Properties (Continued) Property Value Type What it is Valid values: The character alignment type alignment • bottom • center • icf bottom • icf top • roman baseline • top Valid values: Specifies which kind of alternate glyphs should alternate glyphs be used •...
  • Page 71 Adobe Illustrator CS Scripting Guide Table 4.5 Character — Properties (Continued) Property Value Type What it is Valid values: Specifies whether the text is normal, all capitalization uppercase, all small caps, or a mix of small caps • all caps and lowercase •...
  • Page 72 AppleScript Reference Table 4.5 Character — Properties (Continued) Property Value Type What it is Controls the spacing between two characters, kerning real in thousandths of an em space Valid values: The type of automatic kerning method to use kerning method •...
  • Page 73 Adobe Illustrator CS Scripting Guide Table 4.5 Character — Properties (Continued) Property Value Type What it is If true, overprint the fill of the text overprint fill boolean If true, overprinting of the stroke of the text is overprint stroke...
  • Page 74 AppleScript Reference Table 4.5 Character — Properties (Continued) Property Value Type What it is The Wari-Chu line gap warichu gap integer Valid values: The Wari-Chu justification warichu justification • auto justify • center • full justify last line center • full justify •...
  • Page 75 Adobe Illustrator CS Scripting Guide Example 3.1 In the example below, the selection property has all of the properties that character or any other text class would have. -- Make the currently selected text superscript tell application "Illustrator CS" -- Make sure one or more characters of text are selected set selectedText to selection of current document if class of selectedText is text or ¬...
  • Page 76: Character Style, Character Styles

    AppleScript Reference set characterCount to count characters in textFrame set factor to (characterCount + 1) / 2 -- Iterate over each character, changing its horizontal scale repeat with i from 1 to characterCount set hScaling to (factor - i) / factor if hScaling <...
  • Page 77 Adobe Illustrator CS Scripting Guide Table 4.6 character style — Properties Property Value Type What it is Valid values: The alternate glyphs form alternate glyphs • default • expert • full width • half width • jis78 • jis83 • proportional width •...
  • Page 78 AppleScript Reference Table 4.6 character style — Properties Property Value Type What it is If true, the contextual ligature should be contextual ligature boolean used The object’s container container reference The default type for the object’s value default type type class If true, the discretionary ligature should be discretionary ligature boolean...
  • Page 79 Adobe Illustrator CS Scripting Guide Table 4.6 character style — Properties Property Value Type What it is The language of the text language Valid values: • Bokmal Norwegian • Hungarian • Brazillian Portuguese • Icelandic • Bulgarian • Italian • Canadian French •...
  • Page 80 AppleScript Reference Table 4.6 character style — Properties Property Value Type What it is The character rotation angle (in degrees) rotation real The font size in points size real The color of the text stroke stroke color color info The line width of the stroke stroke weight real If true, the OpenType stylistic alternates...
  • Page 81 Adobe Illustrator CS Scripting Guide Table 4.6 character style — Properties Property Value Type What it is Valid values: The Wari-Chu Justification warichu justification • auto justify • center • full justify last line center • full justify • full justify...
  • Page 82: Cmyk Color Info

    AppleScript Reference set the tracking of character style "Big Red" of document 1 to -50 set the capitalization of character style "Big Red" of document 1 to all caps set the fill color of character style "Big Red" of document 1 to {class:RGB color info, red:255, green:0, blue:0} -- 'apply character style' is the event.
  • Page 83: Color Info

    Adobe Illustrator CS Scripting Guide Notes This class is used to define a record which contains the color component values of a CMYK color. It is used for specifying and retrieving color information from an Illustrator document or from page items in a document.
  • Page 84: Color Management Options

    AppleScript Reference • RGB color info • spot color info color management options Specifies the color management options. Table 4.8 color management options — Properties Property Value Type What it is Valid values: The color management intent type; intent default: relative colorimetric •...
  • Page 85: Compound Path Item, Compound Path Items

    Adobe Illustrator CS Scripting Guide Table 4.9 color separation options — Properties (Continued) Property Value Type What it is Valid values: The color separation type; default: composite separation mode • composite • InRIP separation • host based separation compound path item, compound path items A compound path or list of compound paths.
  • Page 86 AppleScript Reference Valid Commands • count • translate • delete • rotate • duplicate • scale • exists • transform • move Notes Paths contained within a compound path or group in a document will be returned as individual paths when a script asks for the paths contained in the document. However, paths contained in a compound path or group will not be returned when a script asks for the paths in a layer which contains the compound path or group.
  • Page 87: Coordinate Options

    Adobe Illustrator CS Scripting Guide Example 6.2 Compound paths contain path items that can be accessed from a script. This example shows how to duplicate the paths in a compound path and then group them in a new group item.
  • Page 88: Dataset, Datasets

    AppleScript Reference Table 4.12 coordinate options — Properties (Continued) Property Value Type What it is Valid values: The artwork position on media position default: center • bottom • bottom left • bottom right • center • left • right • top •...
  • Page 89 Adobe Illustrator CS Scripting Guide Table 4.13 dataset, datasets — Properties (Continued) Property Value type What it is all of the data set’s properties properties record returned in a single record Valid Commands • count • delete • display • exists •...
  • Page 90 AppleScript Reference set hidden of page item "Rec1" of document 1 to true set the contents of text frame "Text1" of document 1 to "Now you don't!" make new dataset in document 1 with properties {name:"My Second Dataset"} repeat 3 times delay 1 display dataset "My First Dataset"...
  • Page 91: Document, Documents

    Adobe Illustrator CS Scripting Guide document, documents An Illustrator document or a list of documents. Documents are contained in the application object. Table 4.14 document, documents — Elements Element: Refer to by: name, index, before/after, range, test brush name, index, before/after, range, test...
  • Page 92 AppleScript Reference Table 4.15 document, documents — Properties Property Value type What it is The best type for the document object’s best type type class value; always returns reference The document object’s class, which is class type class document Valid values: The color specification system to use for color space this document’s color space...
  • Page 93 AppleScript Reference Table 4.15 document, documents — Properties (Continued) Property Value type What it is Valid values: Default type of joints in new paths default stroke join • mitered • rounded • beveled When a default stroke join is set to default stroke miter real mitered, this property specifies when...
  • Page 94 AppleScript Reference Table 4.15 document, documents — Properties (Continued) Property Value type What it is A list of names of predefined Mojikumi Mojikumi set list of Unicode text sets which specify the spacing for the layout and composition of Japanese text The document’s name (not the complete name Unicode text...
  • Page 95 AppleScript Reference Table 4.15 document, documents — Properties (Continued) Property Value type What it is If true, the printer’s default screen use default screen boolean should be used when printing this document If true, the variables are locked variables locked boolean The object’s visible bounds, including visible bounds...
  • Page 96 AppleScript Reference Example 8.1 The following example shows how to make sure a document is open before setting any of the application’s default properties. -- Check to make sure a document is open in Illustrator -- before setting the application's default stroke width to 8 points tell application "Illustrator CS"...
  • Page 97 Adobe Illustrator CS Scripting Guide set strokeDashes to {2.5, 1, 2.5, 1, 2.5, 1} else set strokeDashes to {} end if tell application "Illustrator CS" -- Create a document with the requested color space if documentType starts with "CMYK" then...
  • Page 98: Ellipse

    AppleScript Reference ellipse A class used to create an elliptical path in an Illustrator document. This class can only be used to create new path item objects. Table 4.16 ellipse — Properties Property Value type What it is The bounds of the ellipse bounds list of points If true, the ellipse path should be...
  • Page 99 Adobe Illustrator CS Scripting Guide or class of selectedItems is text ¬ or class of item 1 of selectedItems is not path item then display dialog "Please select a single path item before running this script" else set pathItem to item 1 of selectedItems...
  • Page 100: Eps Save Options

    AppleScript Reference EPS save options Options which may be supplied when saving a document as an Illustrator EPS file. See the save command in the command reference for additional details. Table 4.17 EPS save options — Properties Property Value type What it is If true, the file should be saved as CMYK PostScript...
  • Page 101 Adobe Illustrator CS Scripting Guide Table 4.17 EPS save options — Properties (Continued) Property Value type What it is Valid values: Specifies the format for the EPS preview preview image; • none default: color Macintosh • BW Macintosh • color Macintosh •...
  • Page 102: Flash Export Options

    AppleScript Reference save current document in file newFilePath as eps ¬ with options {class:EPS save options ¬ , compatibility:Illustrator 9 ¬ , preview:color Macintosh ¬ , embed linked files:true ¬ , include document thumbnails:true ¬ , embed all fonts:true ¬ , CMYK PostScript:true ¬...
  • Page 103 Adobe Illustrator CS Scripting Guide Table 4.18 Flash export options — Properties (Continued) Property Value type What it is Level of compression (0–10, default: 3) JPEG quality integer If true, the Flash file should be set to looping boolean loop when run (default: false)
  • Page 104: Flattening Options

    AppleScript Reference flattening options Specifies the transparency flattening options. Flattening is used when Illustrator must output artwork that contains transparency – into a non-native format. Table 4.19 flattening option — Properties Property Value Type What it is If true, complex regions will be clipped; clip complex regions boolean default: false...
  • Page 105: Font, Fonts

    Adobe Illustrator CS Scripting Guide font, fonts An installed font. Table 4.20 font — Properties Property Value Type What it is The best type for the object’s value best type type class The object’s class class type class The default type for the object’s value...
  • Page 106 AppleScript Reference -- For each font, make a new text frame with the name of the font and the font applied to it -- Position the text frames into three columns tell application "Illustrator CS" activate make new document set fontCount to count fonts set x to 1 set startX to 10 set startY to (height of document 1) - 10...
  • Page 107: Gif Export Options

    Adobe Illustrator CS Scripting Guide GIF export options Options which may be supplied when exporting a document as a GIF file. See the export command in the command reference for additional details. Table 4.22 GIF export options — Properties Property...
  • Page 108 AppleScript Reference Table 4.22 GIF export options — Properties (Continued) Property Value type What it is The color to use when matting matte color RGB color info the artboard; default: white If true, the resulting image saving as HTML boolean should be saved with an accompanying HTML file;...
  • Page 109 Adobe Illustrator CS Scripting Guide tell application "Finder" to ¬ set fileName to name of aFile set newFilePath to destinationPath & fileName & ".gif" tell application "Illustrator CS" open aFile export current document to file newFilePath as GIF with options ¬...
  • Page 110: Gradient, Gradients

    AppleScript Reference gradient, gradients A gradient definition or gradient definitions. Gradients are contained in documents. Table 4.23 gradient, gradients — Elements Element: Refer to by: index, before/after, range, test gradient stop Table 4.24 gradient, gradients — Properties Property Value type What it is The best type for the gradient object’s best type...
  • Page 111 Adobe Illustrator CS Scripting Guide Notes Illustrator’s gradient object represents a gradient as defined in the Illustrator application. Additional gradients may be created by the user within Illustrator or via a script. Example 14.1 This example shows how to create a linear RGB gradient.
  • Page 112: Gradient Color Info

    AppleScript Reference gradient color info A gradient color specification, used to specify a gradient color in conjunction with the color property. Note: The gradient color info class inherits all valid properties from the color info class Table 4.25 gradient color info — Properties Property Value type What it is...
  • Page 113: Gradient Stop, Gradient Stops

    Adobe Illustrator CS Scripting Guide gradient stop, gradient stops A gradient stop definition or definitions contained in a specific gradient. Table 4.26 gradient stop, gradient stops — Properties Property Value type What it is The best type for the gradient stop...
  • Page 114 AppleScript Reference Notes Illustrator’s gradient stop object represents a point on a specific gradient defined in the Illustrator application. Each gradient stop specifies a color change in the containing gradient. Example 16.1 This example demonstrates how to reverse the colors in a gradient by getting, then switching, the colors of the contained gradient stops.
  • Page 115: Gradient Stop Info

    Adobe Illustrator CS Scripting Guide gradient stop info Gradient stop information of a specific gradient, returned by the entire gradient property of a gradient. Table 4.27 gradient stop info — Properties Property Value type What it is The color linked to this...
  • Page 116: Graph Item, Graph Items

    AppleScript Reference tell application "Illustrator CS" if not (exists gradient pGradientName in current document) then set entireGradient to {{midpoint:50.0, ramp point:0.0 ¬ , color:{cyan:0.0, magenta:0.0, yellow:0.0, black:100.0}} ¬ , {midpoint:50.0, ramp point:33.3 ¬ , color:{cyan:0.0, magenta:0.0, yellow:100.0, black:0.0}} ¬ , {midpoint:50.0, ramp point:66.7 ¬ , color:{cyan:0.0, magenta:100.0, yellow:0.0, black:0.0}} ¬...
  • Page 117 Adobe Illustrator CS Scripting Guide Valid Commands • count • rotate • delete • scale • duplicate • transform • exists • translate • move Notes Note that it is not necessary to set the type of the content variable before binding.
  • Page 118: Graphic Style, Graphic Styles

    AppleScript Reference graphic style, graphic styles An graphic style or list of graphic styles. Each graphic style defines a set of appearance attributes that you can apply non-destructively to page items. Graphic styles are contained in documents. Table 4.29 graphic style, graphic styles — Properties Property Value type What it is...
  • Page 119: Gray Color Info

    Adobe Illustrator CS Scripting Guide -- Check for empty selection if selectedItems is not {} then tell application "Illustrator CS" -- Create the new group to contain the duplicated items set groupRef to make new group item at document 1...
  • Page 120: Group Item, Group Items

    AppleScript Reference Notes This class is used to define a record which contains the tint value of a gray color. It is used for specifying and retrieving color information from an Illustrator document or from page items in a document. Gray colors are specified using a real value that ranges from 0.0 to 100.0 for the tint of color, where 0.0 represent white and 100.0 represents black.
  • Page 121 Adobe Illustrator CS Scripting Guide Table 4.31 group item, group items — Elements (Continued) Element: Refer to by: name, index, before/after, range, test plugin item name, index, before/after, range, test raster item name, index, before/after, range, test symbol item name, index, before/after, range, test text frame Table 4.32 group item, group items —...
  • Page 122 AppleScript Reference command. The resulting group will be the same object as if the user had placed the file from the user interface using the File > Place… command with the embed checkbox checked. Example 21.1 Create a new group item from the contents of a vector art file, either EPS or PDF. -- Create a new group whose contents will be the contents of a vector art file -- fileRef is an alias or file reference to the vector file to be placed on EmbedVectorFile(fileRef)
  • Page 123 Adobe Illustrator CS Scripting Guide Example 21.3 This example demonstrates how to select all of the page items in a document that are not part of a group by testing the container property of all items with a whose clause.
  • Page 124 AppleScript Reference make new rectangle at end of groupRef with properties ¬ {bounds:{200, 250, 300, 150}, fill color:{green:255}, stroked:false} -- Get a little fancy and create a rotated star at the center of the group set pathRef to make new star at beginning of groupRef with properties ¬ {center point:{300, 250}, radius:25, inner radius:4, point count:4 ¬...
  • Page 125: Illustrator Preferences

    Adobe Illustrator CS Scripting Guide Illustrator preferences Specifies preferences for Illustrator Table 4.33 Illustrator preferences — Properties Property Value type What it is The best type for the object’s value best type type class The object’s class class type type class...
  • Page 126 AppleScript Reference Table 4.34 Illustrator save options — Properties (Continued) Property Value type What it is If true, the document’s ICC profile embed ICC profile boolean should be embedded in the saved file. Only for Illustrator 9 or greater documents. default: false Valid values: How should transparency be flattened flatten output...
  • Page 127 Adobe Illustrator CS Scripting Guide Example 22.1 This handler processes a folder of Illustrator files, saving each with Illustrator 7 compatibility. Note that the class property is specified in the record to ensure that Illustrator can determine the save option class.
  • Page 128: Ink

    AppleScript Reference Specifies the properties of the inks to be used in printing the document. Table 4.35 ink — Properties Property Value Type What it is The ink’s name name Unicode text The ink information properties ink properties Example 23.1 -- Ink Lists -- Get the name of every ink in document 1 -- Make a list of names for display...
  • Page 129: Insertion Point

    Adobe Illustrator CS Scripting Guide Table 4.36 ink properties — Properties (Continued) Property Value Type What it is The dot shape name dot shape Unicode text The ink’s frequency (minimum: 0.0) frequency real Valid values: The ink type kind • black ink •...
  • Page 130 AppleScript Reference Table 4.37 insertion point — Elements (Continued) Elements Refer to by by numeric index, as a range of elements, before/after another element, paragraph satisfying a test by numeric index, as a range of elements, before/after another element, text satisfying a test by numeric index, as a range of elements, before/after another element, word...
  • Page 131 Adobe Illustrator CS Scripting Guide string value is to insert the string in the text frame at the insertion point’s location. Setting the contents to an empty string has no affect. Example 24.1 This example shows several ways of working with insertion points.
  • Page 132: Job Options

    AppleScript Reference job options The print job options. Table 4.39 job options — Properties Property Value Type What it is The bitmap resolution; minimum: 0.0; bitmap resolution real default: 0.0 If true, collate print pages will be collated; collate boolean default: false The number of copies to print;...
  • Page 133 Adobe Illustrator CS Scripting Guide -- Make new text frame in the new layer (non-visible) -- Make the new layer non visible -- Print all layers -- Print only visible layers -- Print only visible and printable layer to file set theDesktop to (path to desktop as string) tell application "Illustrator CS"...
  • Page 134: Jpeg Export Options

    AppleScript Reference JPEG export options Options which may be supplied when exporting a document as a JPEG file. See the export command in the command reference for additional details. Table 4.40 JPEG export options — Properties Property Value type What it is If true, the resulting image should be antialiasing boolean...
  • Page 135 Adobe Illustrator CS Scripting Guide Example 26.1 This handler processes all Illustrator files in a specific folder, exporting each file as a medium- quality JPEG image. Note that the class property is specified in the record to ensure that Illustrator can determine the export option class.
  • Page 136: Layer, Layers

    AppleScript Reference layer, layers A layer or list of layers. Layers may contain nested layers, which are called sublayers in the user interface. Table 4.41 layer, layers — Elements Element: Refer to by: name, index, before/after, range, test compound path item name, index, before/after, range, test graph item name, index, before/after, range, test...
  • Page 137 Adobe Illustrator CS Scripting Guide Table 4.42 layer, layers — Properties (Continued) Property Value type What it is Valid values: The mode used when compositing an blend mode object • color blend • color burn • color dodge • darken •...
  • Page 138 AppleScript Reference Table 4.42 layer, layers — Properties (Continued) Property Value type What it is If true, the layer is editable locked boolean The name of this layer name Unicode text The opacity of this layer, where 100.0 is opacity real completely opaque and 0.0 is completely transparent...
  • Page 139 Adobe Illustrator CS Scripting Guide -- Move the 2nd layer to the top of the stacking order tell application "Illustrator CS" if (count layers of current document) > 1 then move layer 2 of document 1 to before layer 1 of document 1...
  • Page 140: Line

    AppleScript Reference line A line or lines of text in a text frame. Table 4.43 line — Elements Elements Refer to by by name, by numeric index, as a range of elements, before/after another character style element, satisfying a test by numeric index, as a range of elements, before/after another element, character satisfying a test...
  • Page 141 Adobe Illustrator CS Scripting Guide Table 4.44 line — Properties (Continued) Property Value Type What it is Valid values: Specifies the type of alternate glyphs alternate glyphs • default • expert • full width • half width • jis78 • jis83 •...
  • Page 142 AppleScript Reference Table 4.44 line — Properties (Continued) Property Value Type What it is The text content of the text range contents Unicode text If true, the contextual ligature should be contextual ligature boolean used The default type for the object’s value default type type class If true, the discretionary ligature should be...
  • Page 143 Adobe Illustrator CS Scripting Guide Table 4.44 line — Properties (Continued) Property Value Type What it is Valid values: language • Bokmal Norwegian • Japanese • Brazillian • Nynorsk Norwegian Portuguese • Polish • Bulgarian • Romanian • Canadian French •...
  • Page 144 AppleScript Reference Table 4.44 line — Properties (Continued) Property Value Type What it is The character rotation angle rotation real list of text, texts The selected text (ranges) in the text range selection Font size in points size real The story of the text range story story The color of the text stroke...
  • Page 145 Adobe Illustrator CS Scripting Guide Table 4.44 line — Properties (Continued) Property Value Type What it is Valid values: The Wari-Chu Justification warichu justification • auto justify • center • full justify last line center • full justify • full justify...
  • Page 146: Matrix

    AppleScript Reference -- Color red all lines of text containing more than 80 characters tell application "Illustrator CS" if (count text frames in document 1) > 0 then set textItemCount to count text frames in document 1 repeat with i from 1 to textItemCount set (fill color of every line of text frame i of document 1 ¬...
  • Page 147 Adobe Illustrator CS Scripting Guide Valid Commands • concatenate matrix • get rotation matrix • concatenate rotation matrix • get scale matrix • concatenate scale matrix • get translation matrix • concatenate translation matrix • invert matrix • equal matrices •...
  • Page 148: Mesh Item, Mesh Items

    AppleScript Reference Example 29.2 If you need to apply multiple transformations to objects it is more efficient to use the matrix suite than to apply the transformations one at a time. The following script demonstrates how to combine multiple matrices together. -- Scale, rotate, and translate all art in a document tell application "Illustrator CS"...
  • Page 149: No Color Info

    Adobe Illustrator CS Scripting Guide Valid Commands • count • translate • delete • rotate • duplicate • scale • exists • transform • move Notes Mesh items cannot be created from a script, but can be duplicated, copied and pasted.
  • Page 150: Open Options

    AppleScript Reference Open Options Specifies options which may be supplied when opening a file. Table 4.47 Open Options — Properties Property Value type What it is If true, all text objects for documents update legacy text boolean saved with legacy texts (for documents from version 10 or earlier of Illustrator);...
  • Page 151 Adobe Illustrator CS Scripting Guide Table 4.49 page item, page items — Properties Property Value type What it is best type type class The best type for the page item object’s value; always returns reference Valid values: The mode to use when compositing this blend mode object.
  • Page 152 If true, this object is selected selected boolean If true, preserve slices sliced boolean The value of the Adobe URL tag assigned Unicode text to this page item The visibility variable to which this page visibility variable anything item path is bound The object’s visible bounds, including...
  • Page 153 Adobe Illustrator CS Scripting Guide Table 4.49 page item, page items — Properties (Continued) Property Value type What it is The offset to use when wrapping text wrap offset Double around this object If true, wrap text frame objects around...
  • Page 154: Page Marks Options

    AppleScript Reference page marks options Used to specify the page marks options. Table 4.50 page marks options — Properties Property Value Type What it is The bleed offset rectangle bleed offset list If true, color bar printing is enabled color bars boolean default: false The page marks offset rectangle...
  • Page 155: Paper

    Adobe Illustrator CS Scripting Guide paper This class contains information about the paper to be used for printing. Table 4.51 paper — Properties Property Value Type What it is The paper name name Unicode text The paper information properties paper...
  • Page 156: Paper Properties

    AppleScript Reference paper properties Information about the paper. Table 4.53 paper properties — Properties Property Value Type What it is If true, it is a custom paper custom paper boolean The paper’s height (in points) height real list The imageable area imageable area The paper’s width (in points) width...
  • Page 157: Paragraph, Paragraphs

    Adobe Illustrator CS Scripting Guide paragraph, paragraphs A paragraph or list of paragraphs of text in the contents of a text art object. Table 4.54 paragraph — Elements Elements Refer to by by name, by numeric index, as a range of elements, before/after another...
  • Page 158 AppleScript Reference Table 4.55 paragraph — Properties (Continued) Property Value Type What it is Valid values: The character alignment type alignment • bottom • center • icf bottom • icf top • roman baseline • top Valid values: Specifies the type of alternate glyphs alternate glyphs •...
  • Page 159 Adobe Illustrator CS Scripting Guide Table 4.55 paragraph — Properties (Continued) Property Value Type What it is Valid values: The Burasagari type which specifies whether Burasagari type punctuation is allowed to fall outside of the • forced paragraph bounding box (not available when •...
  • Page 160 AppleScript Reference Table 4.55 paragraph — Properties (Continued) Property Value Type What it is The text font font font If true, the OpenType fractions should be fractions boolean used The character horizontal scaling factor horizontal scale real expressed as a percentage (100 = 100%) If true, hyphenation is enabled for the hyphenate capitalized boolean...
  • Page 161 Adobe Illustrator CS Scripting Guide Table 4.55 paragraph — Properties (Continued) Property Value Type What it is The name of a Kinsoku Shori set (a set of Kinsoku Unicode text characters which cannot be used to begin or end a line of Japanese text)
  • Page 162 AppleScript Reference Table 4.55 paragraph — Properties (Continued) Property Value Type What it is Maximum letter spacing expressed as a maximum letter spacing real percentage Maximum word spacing expressed as a maximum word spacing real percentage Minimum number of characters after a hyphen minimum after hyphen integer Minimum number of characters before a...
  • Page 163 Adobe Illustrator CS Scripting Guide Table 4.55 paragraph — Properties (Continued) Property Value Type What it is The selected text (ranges) in the text range selection list of text Valid values: Justification type for a single word single word justification •...
  • Page 164 AppleScript Reference Table 4.55 paragraph — Properties (Continued) Property Value Type What it is Specifies how the characters in Wari-Chu text warichu characters integer (an inset note in Japanese text) are divided after break into two or more lines Specifies how the characters in Wari-Chu text warichu characters integer (an inset note in Japanese text) are divided...
  • Page 165 Adobe Illustrator CS Scripting Guide The paragraph class has additional properties that other related classes do not share, including properties for margins, tab stop settings, hyphenation, and word/letter spacing. Example 35.1 The hyphenation of all text can be quickly changed from a script, as this example shows.
  • Page 166: Paragraph Style, Paragraph Styles

    AppleScript Reference paragraph style, paragraph styles A named style that remembers paragraph attributes. Table 4.56 paragraph style — Properties Property Value Type What it is The best type for the object’s value best type type class The object’s class class type class The default type for the object’s value default type...
  • Page 167 Adobe Illustrator CS Scripting Guide Table 4.56 paragraph style — Properties (Continued) Property Value Type What it is Valid values: Specifies the Japanese text baseline direction baseline direction • standard • Tate Chu Yoko • vertical rotated Valid values: The baseline position of text baseline position •...
  • Page 168 AppleScript Reference Table 4.56 paragraph style — Properties (Continued) Property Value Type What it is Valid values: Specifies which figure style to use in an figure style OpenType font • default • proportional • proportional oldstyle • tabular • tabular oldstyle The color of the text fill fill color...
  • Page 169 Adobe Illustrator CS Scripting Guide Table 4.56 paragraph style — Properties (Continued) Property Value Type What it is Valid values: The automatic kerning method to use kerning method • auto • none • optical The name of a Kinsoku Shori set (a set of...
  • Page 170 AppleScript Reference Table 4.56 paragraph style — Properties (Continued) Property Value Type What it is If true, the ligature should be used ligature boolean Maximum number of consecutive hypenated maximum consecutive integer lines hyphens Maximum glyph scaling expressed as a maximum glyph scaling real percentage...
  • Page 171 Adobe Illustrator CS Scripting Guide Table 4.56 paragraph style — Properties (Continued) Property Value Type What it is Right indent of margin expressed in points right indent real If true, Roman hanging punctuation is roman hanging boolean enabled The character rotation angle...
  • Page 172 AppleScript Reference Table 4.56 paragraph style — Properties (Continued) Property Value Type What it is Character vertical scaling factor vertical scale real Specifies how the characters in Wari-Chu text warichu characters integer (an inset note in Japanese text) are divided after break into two or more lines Specifies how the characters in Wari-Chu text...
  • Page 173: Path Item, Path Items

    Adobe Illustrator CS Scripting Guide activate make new document make new rectangle in document 1 with properties {position:{100, 400}, width:400, height:200} set areaText to make new text frame in document 1 with properties {kind:area text, text path:the result} set theParagraph to "Left justified paragraph." & return & "Center justified paragraph."...
  • Page 174 AppleScript Reference Table 4.58 path item, path items — Properties (Continued) Property Value type What it is If true, this path should be used as a clipping boolean clipping path If true, this path closed closed boolean All the path item’s path points entire path list (of path point info)
  • Page 175 Adobe Illustrator CS Scripting Guide Table 4.58 path item, path items — Properties (Continued) Property Value type What it is When a default stroke join is set to stroke miter limit real mitered, this property specifies when the join will be converted to beveled (squared-off ) by default.
  • Page 176: Path Point, Path Points

    AppleScript Reference path point, path points A point or points on a specific path. Each path point is made up of a fixed point (anchor) and a pair of handles (left direction and right direction). Table 4.59 path point, path points — Properties Property Value type What it is...
  • Page 177 Adobe Illustrator CS Scripting Guide • duplicate • exists • make Notes A path point represents a point of a path, with its pair of control points, or handles. Any point can considered a corner point. Setting the point type property of a path point to a corner forces the left and right direction points to be on a straight line when the user attempts to modify them in the user interface.
  • Page 178: Path Point Info

    AppleScript Reference path point info Path point information for a specific path item, returned by the entire path property of a path item. Table 4.60 path point info — Properties Property Value type What it is The position of a path point’s anchor list anchor point...
  • Page 179: Pattern, Patterns

    Adobe Illustrator CS Scripting Guide pattern, patterns A pattern definition or list of definitions contained in a document. Table 4.61 pattern, patterns — Properties Property Value type What it is The best type for the pattern object’s best type type class value;...
  • Page 180: Pattern Color Info

    AppleScript Reference Example 40.1 The following example demonstrates how the name of a pattern can be retrieved. -- Returns the name of the first pattern tell application "Illustrator CS" set pathname to name of pattern 1 of document 1 end tell pattern color info A pattern color specification, used to specify a pattern color in conjunction with the color property.
  • Page 181: Pdf Options

    Adobe Illustrator CS Scripting Guide Table 4.62 pattern color info — Properties (Continued) Property Value type What it is The distance to translate the unscaled shift distance real prototype pattern before filling; default: 0.0 Notes Pattern colors are created using a reference to an existing pattern in a document. A matrix may be specified to further transform the pattern color.
  • Page 182 AppleScript Reference Table 4.63 PDF options — Properties (Continued) Property Value Type What it is Valid values: What box should be used when placing a PDF crop bounds multipage document • PDF art box default: eAiPDFMediaBox • PDF bleed • PDF bounding •...
  • Page 183: Pdf Save Options

    Adobe Illustrator CS Scripting Guide set user interaction level to never interact set page of PDF file options of settings to 2 open file (theFile as string) end tell PDF save options Options which may be supplied when saving a document as an Acrobat PDF file. See the save command in the command reference for additional details.
  • Page 184 AppleScript Reference Table 4.64 PDF save options — Properties (Continued) Property Value Type What it is Draw color bars; default: false color bars boolean Valid values: Specifies how color bitmap images color compression should be compressed (default: • automatic JPEG high automatic JPEG maximum) •...
  • Page 185 Adobe Illustrator CS Scripting Guide Table 4.64 PDF save options — Properties (Continued) Property Value Type What it is Embed the document’s ICC profile embed ICC profile boolean in the saved file; default: false If true, accessing 128-bit should enable access boolean be enabled;...
  • Page 186 AppleScript Reference Table 4.64 PDF save options — Properties (Continued) Property Value Type What it is If zero: no downsampling, grayscale downsampling real otherwise, specifies the resolution to downsample grayscale images to; default: 150.0 Downsample if the image’s grayscale downsampling real resolution is above this value;...
  • Page 187 Adobe Illustrator CS Scripting Guide Table 4.64 PDF save options — Properties (Continued) Property Value Type What it is Valid values: The page marks style; page marks style default: Roman • japanese • Roman Name of PDF preset to use...
  • Page 188: Photoshop Options

    AppleScript Reference repeat with aFile in fileList tell application "Finder" to set fileName to name of aFile set newFilePath to destinationPath & fileName & ".pdf" tell application "Illustrator CS" open aFile save current document in file newFilePath as pdf ¬ with options {class:PDF save options ¬...
  • Page 189 Adobe Illustrator CS Scripting Guide Table 4.65 Photoshop options — Properties Property Value type What it is If true, the imported images which have pixel aspect ratio boolean a non-square pixel aspect ratio should be correction adjusted If true, image maps should be...
  • Page 190: Photoshop Export Options

    AppleScript Reference Photoshop export options Options which may be supplied when exporting a document as a Photoshop file. See the export command in the command reference for additional details. Table 4.66 Photoshop export options — Properties Property Value type What it is If true, the exported image should be antialiasing boolean...
  • Page 191 Adobe Illustrator CS Scripting Guide Table 4.66 Photoshop export options — Properties (Continued) Property Value type What it is If true, the layers of the Illustrator write layers boolean document should be preserved in the exported image; default: true Notes This class is used to define a record containing properties that specify options when exporting a document as a Photoshop file.
  • Page 192: Placed Item, Placed Items

    AppleScript Reference end tell end repeat end SaveFilesAsPhotoshop -- Call handler set sourceFolder to choose folder with prompt "Source folder?" tell application "Finder" to ¬ set fileList to every file of folder sourceFolder as alias list set destinationFolder to choose folder with prompt "Destination folder?" SaveFilesAsPhotoshop(fileList, destinationFolder) placed item, placed items An artwork item (optionally stored in an external file) placed in a document.
  • Page 193 Adobe Illustrator CS Scripting Guide Valid Commands • count • rotate • delete • scale • duplicate • transform • exists • translate • move Notes When you create a placed item, Illustrator may display a dialog. To avoid this dialog, check the box to turn the warning off the first time the dialog is displayed.
  • Page 194: Plugin Item, Plugin Items

    AppleScript Reference plugin item, plugin items An art object or objects created by an Illustrator plug-in. Note: This object class inherits all valid properties from the page item class. Table 1: plugin item, plugin items — Properties Property Value type What it is All of the plugin item’s properties properties...
  • Page 195 Adobe Illustrator CS Scripting Guide Table 4.68 PNG24 export options — Properties (Continued) Property Value type What it is If true, the artboard should be matted matte boolean with a color; default: true The color to use when matting the...
  • Page 196: Png8 Export Options

    AppleScript Reference tell application "Illustrator CS" open aFile export current document to file newFilePath as PNG24 ¬ with options {class:PNG24 export options ¬ , horizontal scaling:50.0 ¬ , vertical scaling:50.0 ¬ , saving as HTML:true} close current document saving no end tell end repeat end SaveFilesAsPNG24HTML...
  • Page 197 Adobe Illustrator CS Scripting Guide Table 4.69 PNG8 export options — Properties (Continued) Property Value type What it is Valid values: The method used to dither colors; color dither default: diffusion • none • diffusion • pattern dither • noise...
  • Page 198 AppleScript Reference It is not necessary to specify values for all properties. Default values will be provided for any properties not specified. Example 48.1 This handler saves all files in a folder as 8 bit PNG files in HTML format with dithering and interlacing.
  • Page 199: Polygon

    Adobe Illustrator CS Scripting Guide polygon A class used to create a multi-sided path in an Illustrator document. This class can only be used to create new path item objects. Table 4.70 polygon — Properties Property Value type What it is The center point for the polygon;...
  • Page 200: Postscript Options

    AppleScript Reference postscript options Specifies the options for printing to a PostScript language printer or imagesetter. Table 4.71 postscript options — Properties Property Value Type What it is If true, job is to be printed in binary mode; binary printing boolean default: false If true, use PostScript language level 1...
  • Page 201: Ppd Properties

    Adobe Illustrator CS Scripting Guide Example 50.1 -- PPD File -- Make a new document -- Get the PPDs -- Get the name, PS Level, and file path of the first PPD -- Make a new text frame with the PPD info as its contents tell application "Illustrator CS"...
  • Page 202 AppleScript Reference Example 51.1 -- PPD File Combined -- Make a new document -- Get the PPDs -- Get the name, PS Level, screens, screen spot functions, and file path of the first PPD -- For each screen, get the name, angle, and frequency -- For each spot function, get the name and the function -- Make a new text frame with the PPD info as its contents tell application "Illustrator CS"...
  • Page 203: Print Options

    Adobe Illustrator CS Scripting Guide print options Specifies the print options Table 4.74 print options — Properties Property Value Type What it is The printing color management options color management color settings management options The printing color separation options color separation...
  • Page 204: Printer

    AppleScript Reference set theDesktop to (path to desktop as string) tell application "Illustrator CS" activate make new document repeat with i from 1 to 10 round (i / 2 - (round (i / 2) rounding down)) rounding up make new symbol item in document 1 with properties {symbol:symbol i of document 1, position:{100 + (the result * 150), (50 + i * 70)}} end repeat set jobOptions to {class:job options, designation:all layers, reverse...
  • Page 205 Adobe Illustrator CS Scripting Guide name of every item of printers as list repeat with theName in the result set printerList to printerList & theName & return end repeat set user interaction level to interact with all display dialog printerList...
  • Page 206: Printer Properties

    AppleScript Reference printer properties Describes information about the printer. Table 4.76 printer properties — Properties Property Value Type What it is If true, the printer supports binary printing binary printing boolean The printer color capability color support Valid values: • black and white output •...
  • Page 207: Raster Item, Raster Items

    Adobe Illustrator CS Scripting Guide Table 4.76 printer properties — Properties (Continued) Property Value Type What it is The printer type printer type Valid values: • non PostScript printer • PostScript printer • unknown raster item, raster items A bitmap art object or list of objects.
  • Page 208 AppleScript Reference Table 4.77 raster item, raster items — Properties (Continued) Property Value type What it is Valid values: The status of the linked image, if the status image is stored externally • no data • data from file • modified data Valid Commands •...
  • Page 209: Rectangle

    Adobe Illustrator CS Scripting Guide rectangle A class used to create a rectangular path in an Illustrator document. This class can only be used to create new path item objects. Stored as a list of four real numbers, where the first item is...
  • Page 210 AppleScript Reference Example 55.2 The values in a rectangle can be used in a number of ways in a script. tell application "Illustrator CS" -- Get the bounds of a page item set itemBounds to geometric bounds of page item 1 of document 1 -->...
  • Page 211: Rgb Color Info

    Adobe Illustrator CS Scripting Guide RGB color info An RGB color specification, used to specify a RGB color in conjunction with the color property. Note: The RGB color info class inherits all valid properties from the color info class. Table 4.79 RGB color info — Properties...
  • Page 212: Rounded Rectangle

    AppleScript Reference rounded rectangle A class used to create a rectangular path with rounded corners in an Illustrator document. This class can only be used to create new path item objects. Table 4.80 rounded rectangle — Properties Property Value type What it is The bounds of the rectangle to create.
  • Page 213: Screen Properties

    Adobe Illustrator CS Scripting Guide screen properties Screen information Table 4.81 screen properties — Properties Property Value Type What it is The screen’s angle angle real If true, it is the default screen default screen boolean The screen’s frequency frequency real Example 58.1...
  • Page 214: Screen Spot Function

    AppleScript Reference screen spot function Information about the color separation screen spot function. Table 4.82 screen spot function — Properties Property Value Type What it is The color separation screen spot name Unicode text function name The spot function in terms of the PostScript spot function Unicode text commands...
  • Page 215: Separation Screen

    Adobe Illustrator CS Scripting Guide separation screen color separation screen Table 4.83 separation screen — Properties Property Value Type What it is The color separation screen name name Unicode text The color separation screen information properties screen properties spot, spots A spot color definition, or list of definitions, contained in a document.
  • Page 216 AppleScript Reference • make Notes Illustrator’s spot object represents a spot color as defined by Illustrator. All Illustrator documents contain the spot color "[Registration]" which can be used to print to all plates of a separation. If no properties are specified when creating a new spot, default properties will be provided. However, if specifying the color, you must use the same color space as the document, either CMYK or RGB.
  • Page 217: Spot Color Info

    Adobe Illustrator CS Scripting Guide spot color info A spot color specification, used to specify a spot color in conjunction with the color property. Note: The CMYK color info class inherits all valid properties from the color info class. Table 4.85 spot color info — Properties...
  • Page 218: Star

    AppleScript Reference star A class used to create a star-shaped path in an Illustrator document. This class can only be used to create new path item objects. Table 4.86 star — Properties Property Value type What it is The center point of the star; center point fixed point default: {200.0, 300.0}...
  • Page 219: Story, Stories

    Adobe Illustrator CS Scripting Guide story, stories A contiguous block of text with a specified text range. A story can contain one or more text frames; if more—the multiple text frames are linked together to form a single story. Table 4.87 story — Elements...
  • Page 220 AppleScript Reference Example 63.1 -- Story -- Make a new document -- Make two text frames -- Set the previous frame of the second text frame to text frame 1 -- Add a story to text frame 1 (long enough to overflow to text frame 2 -- Count the number of stories -- Add a new text frame -- Count the number of stories...
  • Page 221: Svg Export Options

    Adobe Illustrator CS Scripting Guide SVG export options Options which may be supplied when exporting a document as an SVG file. See the export command in the command reference for additional details. Table 4.89 SVG export options — Properties Property...
  • Page 222 What it is If true, variables and datasets should be include variables and boolean included; default: false datasets If true, the Adobe namespace should be optimize for SVG Viewer boolean included; default: false If true, Illustrator editing capabilities preserve editability...
  • Page 223: Swatch, Swatches

    Adobe Illustrator CS Scripting Guide , embed raster images:true} close current document saving no end tell end repeat end SaveFilesAsSVG -- Call handler set sourceFolder to choose folder with prompt "Source folder?" tell application "Finder" to ¬ set fileList to every file of folder sourceFolder as alias list set destinationFolder to choose folder with prompt "Destination folder?"...
  • Page 224: Symbol, Symbols

    AppleScript Reference Valid Commands • count • delete • duplicate • exists • make Notes The swatches correspond to the swatch palette in Illustrator’s user interface. Additional swatches can be created either manually by a user or by a script. The swatch can hold all types of color data (i.e., pattern, gradient, CMYK, RGB, gray, or spot).
  • Page 225 Adobe Illustrator CS Scripting Guide Table 4.91 symbol, symbols — Properties (Continued) Property Value type What it is The name of the symbol; defaults to name Unicode text “New Symbol nnn” where n is an integer, starting at 1 and increasing with...
  • Page 226: Symbol Item, Symbol Items

    AppleScript Reference symbol item, symbol items A symbol item is an instance of a symbol in a document. symbol items are linked to the symbol from which they are created and will change with any modification of that symbol. Note: This object class inherits all valid properties from the page item class. Table 4.92 symbol item, symbol items —...
  • Page 227: Tab Stop Info

    Adobe Illustrator CS Scripting Guide tab stop info Tab stop information for a paragraph. Table 4.93 tab stop info — Properties Property Value type What it is Valid values: The alignment of the tab stop; alignment default: left • left •...
  • Page 228: Tag, Tags

    AppleScript Reference tag, tags A tag or list of tags associated with a specific page item. Table 4.94 tag, tags — Properties Property Value type What it is The best type for the tag object; always best type type class returns reference The tag object’s class, which is tag class...
  • Page 229: Text, Texts

    Adobe Illustrator CS Scripting Guide set URL of path item "rectPath" of document 1 to "http://www.adobe.com/" get properties of tags of path item "rectPath" of document 1 end tell text, texts Any text in the contents of a text frame.
  • Page 230: Point Type

    AppleScript Reference Table 4.96 text — Properties (Continued) Property Value Type What it is The object’s container container reference The text content of the text range contents Unicode text Controls the spacing between two characters, kerning real in thousandths of an em Length of text range (minimum: 0) length integer...
  • Page 231: Text Frame, Text Frames

    Adobe Illustrator CS Scripting Guide text frame, text frames A text art object or objects. From the user interface, this is text created with the Text tool. Table 4.97 text frame, text frames — Elements Element: Refer to by: index, before/after, range, test...
  • Page 232 AppleScript Reference Table 4.98 text frame, text frames — Properties (Continued) Property Value type What it is If true, the optical alignment is active optical alignment boolean The linked text frame preceding this one previous frame text frame All of the tag’s properties returned in a properties record single record...
  • Page 233 Adobe Illustrator CS Scripting Guide It is not necessary to set the type of the content variable before binding. Illustrator automatically sets the type to be the same as the page item to which it is bound. Example 71.1 This script scales only text frames that are area text, which means they are rectangular regions of text.
  • Page 234: Variable, Variables

    AppleScript Reference make new text frame in document 1 with properties {name:"PointText", contents:"Text Frame 3"} set the position of text frame "PointText" of document 1 to {400, 700} delay 1 set user interaction level to interact with all display dialog ("Text Frame Count: " & (count text frames of document 1) as string) set the contents of text frame "AreaText"...
  • Page 235: View, Views

    Adobe Illustrator CS Scripting Guide Table 4.100 variable, variables — Properties (Continued) Property Value type What it is Valid values: The kind of variable kind • graph • image • textual • unknown • visibility The name of the variable...
  • Page 236 AppleScript Reference Table 4.101 view, views — Properties (Continued) Property Value type What it is All of the view’s properties returned in a properties record single record (properties which are individually read-only remain so in this record). Valid values: The mode of display for this view screen mode •...
  • Page 237 Adobe Illustrator CS Scripting Guide tell application "Illustrator CS" if (count documents) > 0 then set screen mode of view 1 of document 1 to full screen end if end tell 12 Aug 03...
  • Page 238: Word

    AppleScript Reference word A string of text in a text frame that is separated by whitespace. Table 4.102 word — Elements Elements Refer to by by name, by numeric index, as a range of elements, before/after another character style element, satisfying a test by numeric index, as a range of elements, before/after another element, character satisfying a test...
  • Page 239 Adobe Illustrator CS Scripting Guide Table 4.103 word — Properties (Continued) Property Value Type What it is Valid values: Specifies the type of alternate glyphs alternate glyphs • default • expert • full width • half width • jis78 • jis83 •...
  • Page 240 AppleScript Reference Table 4.103 word — Properties (Continued) Property Value Type What it is The text string content of the text range contents Unicode text If true, the contextual ligature should be contextual ligature boolean used The default type for the object’s value default type type class If true, the discretionary ligature should be...
  • Page 241 Adobe Illustrator CS Scripting Guide Table 4.103 word — Properties (Continued) Property Value Type What it is Valid values: language • Japanese • Bokmal Norwegian • Nynorsk Norwegian • Brazillian Portuguese • Polish • Bulgarian • Romanian • Canadian French •...
  • Page 242 AppleScript Reference Table 4.103 word — Properties (Continued) Property Value Type What it is If true, the proportional metrics in the proportional metrics boolean Japanese OpenType font should be used The character rotation angle in degrees rotation real The selected text (ranges) in the text range selection list of text The font size in points...
  • Page 243 Adobe Illustrator CS Scripting Guide Table 4.103 word — Properties (Continued) Property Value Type What it is Valid values: The Wari-Chu Justification warichu justification • auto justify • center • full justify last line center • full justify • full justify...
  • Page 244 AppleScript Reference -- word in all text frames set searchString to text returned of ¬ (display dialog "Word to set color of?" default answer "the") tell application "Illustrator CS" set textArtItemCount to (count text frames in document 1) if (textArtItemCount > 0) then repeat with itemCounter from 1 to textArtItemCount if (((contents of text frame itemCounter of document 1) as string) ¬...
  • Page 245: Command Reference

    Adobe Illustrator CS Scripting Guide Command reference This section covers the commands in the Illustrator AppleScript dictionary, as well as some of the important standard AppleScript commands. When you look at a command in an AppleScript dictionary, you can see only that the command returns an object, or that the command takes an object reference as a parameter.
  • Page 246: Apply

    AppleScript Reference apply Applies a brush or graphic style to one or more page items. Table 4.104 apply — Parameters Parameters What it is Objects supported Returns The brush or graphic nothing object reference • graphic style style to apply to the •...
  • Page 247: Apply Character Style

    Adobe Illustrator CS Scripting Guide apply character style Applies a character style to a specified text object(s). Table 4.105 apply character style — Parameters Objects Parameters What it is Returns supported The character style object or character style objects to be operated upon...
  • Page 248: Change Case

    AppleScript Reference change case Changes the capitalization of the selected text. Table 4.107 change case to — Parameters Objects Parameters What it is Returns supported The text object or objects to be text operated upon The type of case to type lower case/sentence case/title case/upper case...
  • Page 249: Colorize

    Adobe Illustrator CS Scripting Guide colorize Colorize a raster item. Table 4.109 colorize — Parameters Objects Parameters What it is Returns supported The raster item to nothing object reference • raster colorize. item The color to use when raster color coloring the TIFF image.
  • Page 250: Concatenate Rotation Matrix

    AppleScript Reference concatenate rotation matrix Concatenates a rotation angle together with a matrix and returns the resulting matrix. Table 4.111 concatenate rotation matrix — Parameters Parameters What it is Objects supported Returns The first matrix matrix • matrix matrix The rotation angle in angle real degrees Example 78.1...
  • Page 251: Concatenate Translation Matrix

    Adobe Illustrator CS Scripting Guide concatenate translation matrix Concatenates a translation (specified by a horizontal and/or vertical offset) with a matrix to form a single resulting matrix. Table 2: Parameters What it is Objects supported Returns The first matrix matrix •...
  • Page 252: Convert To Paths

    AppleScript Reference convert to paths Create the outline for the frame text. Objects Parameters What it is Returns supported The text frame object or text frame objects to be operated upon Result: group item – null Example 81.1 --This script converts all text art tell application "Illustrator CS"...
  • Page 253: Count

    Adobe Illustrator CS Scripting Guide Example 82.1 --This script copies the selected objects (if any) tell application "Illustrator CS" activate copy end tell count Counts the objects (elements) of the specified class (or the objects matching a test). Table 4.114 count — Parameters...
  • Page 254: Cut

    AppleScript Reference Example 83.1 -- This script shows the user how many paths -- are filled out of the total number in document 1 tell application "Illustrator CS" set pathCount to count every path item of document 1 set numberFilled to ¬ count (path items of document 1 whose filled is true) end tell display dialog numberFilled &...
  • Page 255: Delete

    Adobe Illustrator CS Scripting Guide tell application "Illustrator CS" activate end tell delete Removes an element from an object. Table 4.116 delete — Parameters Parameters What it is Objects supported Returns Object(s) to delete nothing object reference or • compound path...
  • Page 256: Deselect

    AppleScript Reference deselect Deselects the text range. Table 4.117 deselect — Parameters Objects Parameters What it is Returns supported text The text object or objects to be operated upon display Display the dynamic data that has been captured in the dataset. Table 4.118 display —...
  • Page 257: Do Script

    Adobe Illustrator CS Scripting Guide do script Plays an action from the Actions palette. Table 4.120 do script — Parameters Parameters What it is Objects supported Returns The name of the action none nothing Unicode text to play (this is case-...
  • Page 258: Duplicate

    AppleScript Reference duplicate Duplicates an object(s). Returns reference(s) to newly created object(s). Table 4.121 duplicate — Parameters Parameters What it is Objects supported Returns The object(s) to all objects except: object reference or list object reference duplicate or list (of •...
  • Page 259: Equal Matrices

    Adobe Illustrator CS Scripting Guide equal matrices Compares two matrices for equality. If equal, Returns returns a boolean which is if the true matrcies are equal. Table 4.122 equal matrices — Parameters Parameters What it is Objects supported Returns The first matrix for the matrix •...
  • Page 260: Export

    AppleScript Reference export Exports the specified document. Table 4.124 export — Parameters Parameters What it is Objects supported Returns The document to export nothing object reference • document The file to export the to [file] file document into, specified specification as a string containing the full file path or an alias.
  • Page 261: Export Pdf Preset

    Adobe Illustrator CS Scripting Guide export PDF preset This command exports PDF presets and saves all PDF presets to a file. Table 4.125 export PDF preset — Parameters Parameters What it is Objects supported Returns The document object or document...
  • Page 262: Export Variables

    AppleScript Reference export variables Saves datasets into an XML library. The datasets contain variables and their associated dynamic data. Table 4.127 export variables — Parameters Parameters What it is Objects supported Returns The document object or nothing document • variables objects to be operated The file to export the to [file] file...
  • Page 263: Get Identity Matrix

    Adobe Illustrator CS Scripting Guide tell application “Illustrator CS” set textString to contents of text frame 1 of document 1 set textRef to text of text frame 1 of document 1 as reference end tell get identity matrix Returns an identity matrix.
  • Page 264: Get Rotation Matrix

    AppleScript Reference get rotation matrix Returns a rotation matrix based on a specified rotation angle. Table 4.130 get rotation matrix — Parameters Parameters What it is Objects supported Returns The rotation angle in [angle real] • matrix matrix degrees; default: 0.0 Notes If no angle is supplied, the standard identity matrix is returned.
  • Page 265: Get Translation Matrix

    Adobe Illustrator CS Scripting Guide Example 94.1 -- This script gets a scale matrix tell application "Illustrator CS" set scaleMatrix to get scale matrix horizontal scale 100.0 vertical scale 50.0 end tell get translation matrix Returns a translation matrix based on a single movement with horizontal and vertical offsets.
  • Page 266: Import Paragraph Styles

    AppleScript Reference Parameters What it is Objects Returns supported File to import from from file specification import paragraph styles Load the paragraph styles from the Illustrator file. Parameters What it is Objects Returns supported The document object or document objects to be operated upon File to import from from file specification 12 Aug 03...
  • Page 267: Import Pdf Preset

    Adobe Illustrator CS Scripting Guide import PDF preset Loads all PDF presets from a file. Table 4.133 import PDF preset — Parameters Parameters What it is Objects supported Returns The document object or document objects to be operated upon File to import from...
  • Page 268: Import Variables

    AppleScript Reference import variables Import a variable library from a file of saved variables. Table 4.135 import variables — Parameters Parameters What it is Objects supported Returns The file to import the from [file] file • variables variables from, specified specification as a string containing the full file path or an...
  • Page 269: Make

    Adobe Illustrator CS Scripting Guide make Creates a new object and returns a reference to newly created object. Table 4.137 make — Parameters Parameters What it is Objects supported Returns The class of object to all objects except: new type class object reference create.
  • Page 270: Move

    AppleScript Reference move Moves one or more objects to a new location; returns references to the moved object or objects at the new location. Table 4.138 move — Parameters Parameters What it is Objects supported Returns Object(s) to move object reference or list object reference •...
  • Page 271: Open

    Adobe Illustrator CS Scripting Guide open Opens one or more specified documents. Table 4.139 open — Parameters Parameters What it is Objects supported Returns The file to be opened any file Illustrator can nothing anything open Opens the document(s) [forcing RGB/...
  • Page 272: Paste

    AppleScript Reference paste Pastes the clipboard contents into the current layer of the current document. Table 4.140 paste — Parameters Parameters What it is Objects supported Returns nothing none • compound path item • group item • mesh item • path item •...
  • Page 273: Print

    Adobe Illustrator CS Scripting Guide print Print one or more documents or files. Table 4.141 print — Parameters Parameters What it is Objects supported Returns anything Document, file or list of nothing • document documents and/or files • any file Illustrator...
  • Page 274: Redraw

    AppleScript Reference tell application "Illustrator CS" activate set the clipboard to {} close every document saving no quit end tell redraw Forces Illustrator to redraw its window(s). Table 4.143 redraw Parameters What it is Objects supported Returns nothing none • application Example 103.1 -- This script redraws all windows in Illustrator tell application "Illustrator CS"...
  • Page 275: Rotate

    Adobe Illustrator CS Scripting Guide rotate Rotates one or more page items by a specified rotation angle. Table 4.144 rotate — Parameters Parameters What it is Objects supported Returns The page item nothing page item • compound path object(s) you want to...
  • Page 276: Save

    AppleScript Reference Notes The rotate command provides many variations when used in conjunction with the about parameter. Experiment with different choices for the about parameter to see what the results are for each setting. Example 104.1 -- Rotate the first page item by 45 degrees using the -- bottom left corner as the rotation pivot point tell application "Illustrator CS"...
  • Page 277 Adobe Illustrator CS Scripting Guide Example 105.1 This example shows to batch process folders of Illustrator documents, saving each as a PDF file with specific settings. -- Processes all files in folders dropped on this script -- (when saved as an applet) and save each Illustrator file as a PDF file...
  • Page 278 AppleScript Reference tell application "Finder" to set fileName to name of aFile set newFilePath to destinationPath & fileName & ".pdf" tell application "Illustrator CS" open aFile save current document in file newFilePath as pdf ¬ with options {class:PDF save options ¬ , compatibility:Acrobat 5 ¬...
  • Page 279: Scale

    Adobe Illustrator CS Scripting Guide scale Scales one or more page items by the specified horizontal and vertical amounts. Table 4.146 scale — Parameters Parameters What it is Objects supported Returns The page item object(s) you want nothing page item •...
  • Page 280: Select

    AppleScript Reference Table 4.146 scale — Parameters (Continued) Parameters What it is Objects supported Returns The point in the bounding box of [about document the page item(s) to which the origin/top left/ scaling is applied left/bottom left/ top/center/ bottom/top right/ right/bottom right] Notes...
  • Page 281: Set

    Adobe Illustrator CS Scripting Guide Changes a variable’s value or an object’s data or property. This is a standard AppleScript command used to assign values to variables and object properties. Table 4.148 set — Parameters Parameters What it is Objects supported...
  • Page 282 AppleScript Reference Notes A singular matrix cannot be inverted. Example 108.1 -- This script gets an identity matrix and then -- test to see if it can be inverted (if not singular) -- If it can, then it inverts it tell application "Illustrator CS"...
  • Page 283: Transform

    Adobe Illustrator CS Scripting Guide transform Transform one or more page items by a specified matrix. Table 4.151 transform — Parameters Parameters What it is Objects supported Returns The page item object(s) you want nothing page item • compound path...
  • Page 284: Translate

    AppleScript Reference Experiment with different choices for the about parameter to see what the results are for each setting. Example 109.1 -- This script skews an object 45 degrees to the right horizontally -- by generating a rotation matrix and setting the appropriate matrix values tell application "Illustrator CS"...
  • Page 285: Translate Placeholder Text

    Adobe Illustrator CS Scripting Guide Notes Use translate to move objects relatively from their existing position. Set the position property of an object to move the object to absolute coordinates. Example 110.1 --This script moves the first page item to new relative coordinates tell application "Illustrator CS"...
  • Page 286 AppleScript Reference 12 Aug 03...
  • Page 287: Chapter 5: Visual Basic Reference

    Visual Basic Reference This reference section describes the objects and commands in Illustrator’s Visual Basic type library. All of the classes in the type library are presented alphabetically. The chapter concludes with an enumerations reference which lists all of the enumerations in the Illustrator type library.
  • Page 288: Referencing And Creating Objects In Visual Basic

    Visual Basic Reference paste the script into a macro routine. In either case, modify the Sub statement in the example to work with your situation. Referencing and creating objects in Visual Basic As the object model diagram shows, all objects are arranged in a hierarchy. To obtain a reference to a specific object you need to navigate the hierarchy.
  • Page 289: Syntax Differences Between Sub And Function Methods

    Adobe Illustrator CS Scripting Guide There are a number of objects in addition to Application that cannot be obtained by using the hierarchy shown in the object model diagram. These objects must created directly using the techniques shown above for the Application object. Those objects include:...
  • Page 290: Application

    Function, Add, and a Sub, ApplyTo, in Visual Basic. Set newDoc = appRef.Open("C:\myfile.eps") appRef.ActiveDocument.GraphicStyles(2).ApplyTo artItem Application The Adobe Illustrator application object, which contains all other Illustrator objects. Table 5.1 Application — Properties Property Value type...
  • Page 291 UserInteractionLevel AiUserInteractionLevel Whether or not to interact with users by displaying dialogs during the running of a script String The version of the Adobe Illustrator Version application Boolean If true, the application is visible Visible Table 5.2 Application —...
  • Page 292 Visual Basic Reference Table 5.2 Application — Methods (Continued) Method Returns What it does Returns an identity matrix GetIdentityMatrix() Matrix object Returns a transformation matrix GetRotationMatrix([angle As Double]) Matrix containing a single rotation object Returns a transformation matrix GetScaleMatrix( Matrix containing a single scale [scaleX As Double], object...
  • Page 293 Adobe Illustrator CS Scripting Guide Notes To open a document and obtain a reference to the document that was opened use this code: ' Open a document and get the reference to it Dim appRef as New Illustrator.Application Dim docRef as Illustrator.Document Set docRef = appRef.Open("C:\temp\aFile.ai")
  • Page 294 Visual Basic Reference WEND msgbox "Done" DoJavaScript and DoJavaScriptFile can be used to invoke script written in JavaScript for Illustrator. Please refer to the JavaScript documentation for how to write JavaScripts for Illustrator. Both methods returns the value of the last executed JavaScript statement. The following script will display an alert using the JavaScript alert method.
  • Page 295: Brush

    Adobe Illustrator CS Scripting Guide Brush A brush in an Illustrator document. Brushes are contained in documents. Table 5.3 Brush — Properties Property Value type What it is The Illustrator Application object Application Application object The Brush name Name String...
  • Page 296: Brushes

    Visual Basic Reference Brushes A collection of brushes in a document. Table 5.5 Brushes — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The document that contains this Parent Document object Brushes object...
  • Page 297: Characterattributes

    Adobe Illustrator CS Scripting Guide CharacterAttributes Specifies the properties of a character. Table 5.7 CharacterAttributes — Properties Property Value Type What it is The amount of inter-glyph space added to the AkiLeft Double left side of the glyph in Japanese text (in...
  • Page 298 Visual Basic Reference Table 5.7 CharacterAttributes — Properties (Continued) Property Value Type What it is If true, the Japanese font supports italics Italics Boolean Specifies the kerning method to be used KerningMethod AiAutoKernType The language of the text Language AiLanguageType The amount of space between two lines of text, Leading Double...
  • Page 299 Adobe Illustrator CS Scripting Guide Table 5.7 CharacterAttributes — Properties (Continued) Property Value Type What it is Specifies how the characters in Wari-Chu text (an WarichiCharacters- Long inset note in Japanese text) are divided into two AfterBreak or more lines...
  • Page 300: Characters

    Visual Basic Reference Characters Characters is a collection of TextRange objects with each TextRange representing a single character. Table 5.8 Characters — Properties Property Value type What it is Application that the collection belongs to Application Application Number of elements in the collection Count Long The object’s container...
  • Page 301: Characterstyle

    Adobe Illustrator CS Scripting Guide CharacterStyle A named style that specifies character attributes. Table 5.10 CharacterStyle — Properties Property Value type What it is Application to which the collection Application Application belongs The character properties for the text CharacterAttributes CharacterAttributes range the character style’s name...
  • Page 302 Visual Basic Reference Table 5.13 CharacterStyles — Methods Method Returns What it does Create a named character style Add(Name As String) CharacterStyle Returns the index position of the object Index(ItemPtr as CharacterStyle) Long within the collection Returns an object reference to the object Item(ItemKey) CharacterSytle identified by itemKey;...
  • Page 303: Cmykcolor

    Adobe Illustrator CS Scripting Guide Dim charStyle As Illustrator.CharacterStyle Set charStyle = docRef.CharacterStyles.Add("BigRed") ' Create a red color Dim colorRed As New Illustrator.RGBColor colorRed.Red = 255 ' Set character attributes of the new style With charStyle.CharacterAttributes .Size = 40 .Tracking = -50 .Capitalization = aiNormalCaps...
  • Page 304: Compoundpathitem

    Visual Basic Reference CMYK color specification into a RGB color specification. The same thing happens if the document’s DocumentColorSpace is aiDocumentCMYKColor and you specify colors using RGBColor. Since this translation can cause information loss you should specify colors using the class that matches the document’s DocumentColorSpace. Example 7.1 Dim appRef As New Illustrator.Application Dim frontPath As Illustrator.PathItem...
  • Page 305 The tags contained in this object Tags Tags collection object The top position of the Double CompoundPathItem The value of the Adobe URL tag assigned String to this CompoundPathItem The VisibilityVariable bound to VisibilityVariable Variable this CompoundPathItem Variant Array (of 4...
  • Page 306 Visual Basic Reference Table 5.15 CompoundPathItem — Properties (Continued) Property Value type What it is The width of the CompoundPathItem, Width Double excluding stroke width, calculated from the GeometricBounds If true, the text frame object should be WrapInside Boolean wrapped inside this object The offset to use when wrapping text WrapOffset Double...
  • Page 307 Adobe Illustrator CS Scripting Guide Table 5.16 CompoundPathItem — Methods (Continued) Method Returns What it does Nothing Rotates the art object relative to the Rotate( current rotation. The object is Angle As Double, rotated counter-clockwise if the [changePositions As Boolean],...
  • Page 308 Visual Basic Reference Example 8.1 This example demonstrates how to select all of the paths in a document that are not part of a compound path or a group by testing the type of the Parent property with a TypeName function.
  • Page 309: Compoundpathitems

    Adobe Illustrator CS Scripting Guide 'Set the gradient of the compound path newPath.Stroked = True newPath.StrokeWidth = 3.5 newPath.StrokeColor = frontDocument.Swatches(8).Color CompoundPathItems A collection of compound paths. Table 5.17 CompoundPathItems — Properties Property Value type What it is The Illustrator Application object...
  • Page 310: Dataset

    Visual Basic Reference If appRef.Documents.Count > 0 Then numCPaths = appRef.ActiveDocument.Layers(1).CompoundPathItems.Count MsgBox ("There are " & numCPaths & " compound paths in the document.") End If DataSet A set of data used for dynamic publishing. Table 5.19 DataSet — Properties Property Value type What it is...
  • Page 311: Datasets

    Adobe Illustrator CS Scripting Guide DataSets A collection of DataSets. Table 5.21 DataSets — Properties Property Value type What it is The Illustrator Application object Application Application object The number of datasets in the collection Count Long The name of the object that is this...
  • Page 312: Document

    Visual Basic Reference visibilityVar.Kind = aiVisibility itemRef.VisibilityVariable = visibilityVar ' Create a text variable Dim textRef As Illustrator.TextFrame Set textRef = docRef.TextFrames.Add textRef.Contents = "Text Variable, dataset 1" textRef.Top = 400 textRef.Left = 200 Dim textVar As Illustrator.Variable Set textVar = docRef.Variables.Add textVar.Kind = aiTextual textRef.ContentVariable = textVar MsgBox "There are "...
  • Page 313 Adobe Illustrator CS Scripting Guide Table 5.23 Document — Properties (Continued) Property Value type What it is The Brushes contained in the Brushes Brushes collection document object The list of character styles in this CharacterStyles CharacterStyles document The CompoundPathItems contained in...
  • Page 314 Visual Basic Reference Table 5.23 Document — Properties (Continued) Property Value type What it is When a default stroke join is set to DefaultStrokeMiterLimit Double mitered, this property specifies when the join will be converted to beveled (squared-off ) by default. The default miter limit of 4 means that when the length of the point reaches four times the stroke weight, the join switches from a miter join...
  • Page 315 Adobe Illustrator CS Scripting Guide Table 5.23 Document — Properties (Continued) Property Value type What it is A list of names of predefined Mojikumi MojikumiSet Object sets which specify the spacing for the layout and composition of Japanese text The document’s name (not the complete...
  • Page 316 Visual Basic Reference Table 5.23 Document — Properties (Continued) Property Value type What it is Variant Array (of The array of references to the objects in Selection objects) this document’s current selection If true, placed images should be ShowPlacedImages Boolean displayed in the document If true, long paths should be split when SplitLongPaths...
  • Page 317 Visual Basic Reference Table 5.24 Document — Methods Method Returns What it does Nothing Bring the first window associated with Activate() the document to the front Nothing Closes a document Close([saving As AiSaveOptions]) Nothing Copies the current selection in the Copy() document to the clipboard;...
  • Page 318 Visual Basic Reference Table 5.24 Document — Methods (Continued) Method Returns What it does Nothing Pastes the contents of the clipboard into Paste() the current layer of the document; if the document is the frontmost then all pasted objects remain selected after the paste Nothing Prints the document...
  • Page 319: Documents

    Visual Basic Reference Example 11.2 This example demonstrates how to create a new document with specific default properties. Dim appRef As New Illustrator.Application Dim frontDocument As Illustrator.Document If (appRef.Documents.Count = 0) Then Set frontDocument = appRef.Documents.Add Else Set frontDocument = appRef.Documents(1) End If frontDocument.DefaultFilled = True frontDocument.DefaultStroked = True...
  • Page 320: Epssaveoptions

    Visual Basic Reference Example 12.1 This examples demonstrates how to create a new document with a specific color space. Dim appRef As New Illustrator.Application appRef.Documents.Add aiDocumentRGBColor EPSSaveOptions Options which may be supplied when saving a document as an Illustrator EPS file. See the SaveAs method for additional details.
  • Page 321: Exportoptionsflash

    Adobe Illustrator CS Scripting Guide Notes EPSSaveOptions can only be supplied in conjunction with the SaveAs method. It is not necessary to specify values for all properties. Default values will be provided for any properties not specified. Example 13.1 This example demonstrates how to save the current document as an Illustrator 8-compatible EPS file using CMYK PostScript with all fonts embedded.
  • Page 322: Exportoptionsgif

    Visual Basic Reference Table 5.28 ExportOptionsFlash — Properties (Continued) Property Value type What it is The display rate in frames per second; FrameRate Double values: 0.01–120; default: If true, the image should be exported as GenerateHTML Boolean an HTML file; default: true How should the image in the exported ImageFormat AiFlashImageFormat...
  • Page 323 Adobe Illustrator CS Scripting Guide Table 5.29 ExportOptionsGIF — Properties (Continued) Property Value type What it is The number of colors in the exported ColorCount Long image’s color table. Acceptable values range from 2 to 256. Default value: 128 The method used to dither colors in the...
  • Page 324: Exportoptionsjpeg

    Visual Basic Reference Example 14.1 This example demonstrates how to export the current document as a GIF. Dim appRef As New Illustrator.Application Dim gifExportOptions As New Illustrator.ExportOptionsGIF Dim docRef As Illustrator.Document If appRef.Documents.Count > 0 Then gifExportOptions.AntiAliasing = False gifExportOptions.ColorCount = 64 gifExportOptions.ColorDither = aiDiffusion Set docRef = appRef.ActiveDocument docRef.Export "C:\temp\AiExport.gif", aiGIF, gifExportOptions...
  • Page 325 Adobe Illustrator CS Scripting Guide Table 5.30 ExportOptionsJPEG — Properties (Continued) Property Value type What it is The quality of the exported image; value QualitySetting Long ranges from 0 to 100; default value is 30 If true, the exported image should be...
  • Page 326: Exportoptionsphotoshop

    Visual Basic Reference ExportOptionsPhotoshop Options which may be supplied when exporting a document as a Photoshop file. See the Export method for additional details. Table 5.31 ExportOptionsPhotoshop — Properties Property Value type What it is If true, the exported image should be AntiAliasing Boolean anti-aliased;...
  • Page 327: Exportoptionspng24

    Adobe Illustrator CS Scripting Guide Example 16.1 This example exports the current document as a Photoshop 5 file with layers. Dim appRef As New Illustrator.Application Dim psdExportOptions As New Illustrator.ExportOptionsPhotoshop Dim docRef As Illustrator.Document If appRef.Documents.Count > 0 Then psdExportOptions.Resolution = 150 Set docRef = appRef.ActiveDocument...
  • Page 328: Exportoptionspng8

    Visual Basic Reference Notes It is not necessary to specify values for all properties. Default values will be provided for any properties not specified. Example 17.1 This example exports the current document as a PNG24 file with specific options. Dim appRef As New Illustrator.Application Dim png24ExportOptions As New Illustrator.ExportOptionsPNG24 Dim docRef As Illustrator.Document If appRef.Documents.Count >...
  • Page 329 Adobe Illustrator CS Scripting Guide Table 5.33 ExportOptionsPNG8 — Properties (Continued) Property Value type What it is ColorReduction AiColorReductionMethod enumeration The method used to reduce the number of colors in the exported image; default: aiSelective Specifies how much the colors of the...
  • Page 330: Exportoptionssvg

    Boolean Platform) metadata should be included in the output file; default: false If true, Variables and Datasets IncludeVariablesAndData Boolean should be included; default: false sets If true, the Adobe namespace should be OptimizeForSVGViewer Boolean included; default: false 12 Aug 03...
  • Page 331: Gradient

    Adobe Illustrator CS Scripting Guide Table 5.34 ExportOptionsSVG — Properties (Continued) Property Value type What it is If true, preserve Illustrator editing PreserveEditability Boolean capability when exporting the document; default: false If true, preserve slice data in exported Slices Boolean document;...
  • Page 332 Visual Basic Reference Table 5.35 Gradient — Properties Property Value type What it is The kind of the gradient, either radial or Type AiGradientType linear enumeration Table 5.36 Gradient — Methods Method Returns What it does Nothing Delete the object Delete() Notes Illustrator’s Gradient object represents a gradient as defined in the Illustrator application.
  • Page 333: Gradients

    Adobe Illustrator CS Scripting Guide 'Modify the first gradient stop. Set locationSpecification = newGradient.GradientStops(1) locationSpecification.RampPoint = 30 locationSpecification.MidPoint = 60 locationSpecification.Color = startColor 'Modify the last gradient stop. 'The MidPoint for the last gradient stop is ignored Set locationSpecification = newGradient.GradientStops(2) locationSpecification.RampPoint = 80...
  • Page 334: Gradientcolor

    Visual Basic Reference Table 5.38 Gradients — Methods (Continued) Method Returns What it does Returns an object reference to the object item(itemKey) Gradient object identified by itemKey; by name or index Nothing Deletes all objects in this collection RemoveAll() Notes Illustrator’s Gradient object represents a gradient as defined in the Illustrator application.
  • Page 335 Adobe Illustrator CS Scripting Guide Table 5.39 GradientColor — Properties (Continued) Property Value type What it is The gradient hilite vector length HiliteLength Double The gradient vector length Length Double An additional transformation matrix to Matrix Matrix object manipulate the gradient path...
  • Page 336: Gradientstop

    Visual Basic Reference GradientStop A gradient stop definition contained in a specific gradient. Table 5.40 GradientStop — Properties Property Value type What it is The Illustrator Application object Application Application object The color linked to this gradient stop Color Color object The distance between two Midpoint Double...
  • Page 337 Adobe Illustrator CS Scripting Guide Table 5.42 GradientStops — Properties Property Value type What it is The document that contains this gradient Parent Document object stops object Table 5.43 GradientStops — Methods Method Returns What it does GradientStop object Creates a new object...
  • Page 338: Graphicstyle

    Visual Basic Reference 'Set the values of the new gradient stop. We move the original last 'gradient stop a bit to the left and 'insert the new gradient stop at the old gradient stops position newStop.RampPoint = lastStop.RampPoint lastStop.RampPoint = lastStop.RampPoint - 10 'Create a new color to apply to the newly created gradient stop 'we choose a Gray tint value of 70% Dim newStopColor As New Illustrator.GrayColor...
  • Page 339: Graphicstyles

    Adobe Illustrator CS Scripting Guide Example 24.1 This example duplicates and groups the current selection, applying the second graphic style in the document to the items in the group. Dim appRef As New Illustrator.Application Dim newGroup As Illustrator.GroupItem Dim dupItem As Object...
  • Page 340: Graphitem

    Visual Basic Reference Table 5.47 GraphicStyles — Methods Method Returns What it does Returns an object reference to the object Item(itemKey) GraphicStyle object identified by itemKey; by name or index Nothing Deletes all objects in this collection RemoveAll() Notes Illustrator’s GraphicStyle object represents an graphic style as defined in the Illustrator application.
  • Page 341 The collection of Tags contained in this Tags Tags object GraphItem The top position of the GraphItem Double The value of the Adobe URL tag assigned String to this GraphItem The Variable bound to this GraphItem VisibilityVariable Variable Variant Array (of 4...
  • Page 342 Visual Basic Reference Table 5.48 GraphItem — Properties (Continued) Property Value type What it is If true, wrap text frame objects around Wrapped Boolean this object (text frame must be above the object) The position of this GraphItem within ZOrderPosition Long the stacking order of the GroupItem or Layer (Parent) that contains the...
  • Page 343 Adobe Illustrator CS Scripting Guide Table 5.49 GraphItem — Methods (Continued) Method Returns What it does Nothing Rotates the GraphItem relative to the Rotate( current rotation; the object is rotated Angle As Double, counter-clockwise if the Angle value is [changePositions As Boolean],...
  • Page 344: Graphitems

    Visual Basic Reference ' 90 degrees. Dim appRef As New Illustrator.Application Dim ok As Boolean ok = True ' verify a document with graph item is open If (appRef.Documents.Count < 1) Then ok = False ElseIf (appRef.ActiveDocument.GraphItems.Count < 1) Then ok = False End If If (ok = False) Then...
  • Page 345: Graycolor

    Adobe Illustrator CS Scripting Guide Table 5.51 GraphItems — Methods Method Returns What it does Nothing Deletes all objects in this collection RemoveAll() GrayColor A gray color specification used to apply a Gray color to an art item. Table 5.52 GrayColor — Properties...
  • Page 346: Groupitem

    Visual Basic Reference GroupItem A grouped set of art objects. Table 5.53 GroupItem — Properties Property Value type What it is The Illustrator Application object Application Application object Is this object used to create a knockout? If ArtworkKnockout AiKnockoutState so, what kind of knockout? enumeration The mode used when compositing an BlendingMode...
  • Page 347 TextFrames TextFrames The TextFrames contained in collection object this GroupItem The top position of the GroupItem Double The value of the Adobe URL tag assigned String to this GroupItem The Variable bound to this VisibilityVariable Variable GroupItem Variant Array (of 4...
  • Page 348 Visual Basic Reference Table 5.53 GroupItem — Properties (Continued) Property Value type What it is The position of this art object within the ZOrderPosition Long stacking order of the group or layer (Parent) that contains the art object Table 5.54 GroupItem — Methods Method Returns What it does...
  • Page 349 Adobe Illustrator CS Scripting Guide Table 5.54 GroupItem — Methods (Continued) Method Returns What it does Nothing Rotates the art object relative to the Rotate( current rotation. The object is rotated Angle As Double, counter-clockwise if the Angle value is...
  • Page 350: Groupitems

    Visual Basic Reference Dim appRef As New Illustrator.Application Dim triangleGroup As Illustrator.GroupItem 'Create a new group in the active document. This will be the group the holds 'the new triangle art Set triangleGroup = appRef.ActiveDocument.GroupItems.Add 'Create a triangle and add text. All new art are created inside a group Dim trianglePath As Illustrator.PathItem Dim captionText As Illustrator.TextFrame Set trianglePath = triangleGroup.PathItems.Add...
  • Page 351: Illustratorsaveoptions

    Adobe Illustrator CS Scripting Guide Table 5.56 GroupItems — Methods Method Returns What it does Returns an object reference to the object Item(ItemKey) GroupItem identified by itemKey; by name or index Nothing Deletes all objects in this collection RemoveAll() Example 29.1 The following script shows how you can import a PDF document using the CreateFromFile function.
  • Page 352 Visual Basic Reference Table 5.57 IllustratorSaveOptions — Properties Property Value type What it is If true, linked image files should be EmbedLinkedFiles Boolean included in the saved document (only valid for SaveOptions that specify an Illustrator compatibility of version 7 or later) Specifies how transparency should be FlattenOutput...
  • Page 353: Ink

    Adobe Illustrator CS Scripting Guide Provides information about the ink name and related information. Table 5.58 Ink — Properties Property Value type What it is Application to which the collection Application AiApplication belongs object The ink information InkInfo InkInfo object The ink’s name...
  • Page 354: Inkinfo

    Visual Basic Reference InkInfo Specifies ink properties. Table 5.59 InkInfo — Properties Property Value type What it is The ink’s screen angle (in degrees) Angle Double Application to which the collection Application Application object belongs The color of the custom ink CustomColor Object The neutral density (minimum: 0.0)
  • Page 355: Insertionpoint

    Adobe Illustrator CS Scripting Guide InsertionPoint A location between characters, used to insert new text objects. Table 5.60 InsertionPoint — Properties Property Value type What it is Application that the collection belongs to Application Application All of the characters in the text range...
  • Page 356: Layer

    Visual Basic Reference ' Use insertion points to add a space between ' every character. Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document ' create a new document and simple text frame Set docRef = appRef.Documents.Add() Dim textRef As Illustrator.TextFrame Set textRef = docRef.TextFrames.Add() textRef.Contents = "Wouldn't you rather be scripting?"...
  • Page 357 Adobe Illustrator CS Scripting Guide Table 5.63 Layer — Properties (Continued) Property Value type What it is The GraphItems collection contained GraphItems GraphItems in this Layer collection object The GroupItems contained in this GroupItems GroupItems collection object Layer If true, an object in this Layer has...
  • Page 358 Visual Basic Reference Table 5.63 Layer — Properties (Continued) Property Value type What it is The TextFrames contained in this TextFrames TextFrameItems collection object Layer If true, this Layer is visible Visible Boolean The position of this Layer within the ZOrderPosition Long stacking order of Layers in the...
  • Page 359: Layers

    Adobe Illustrator CS Scripting Guide 'Get a reference to the layers, and obtain the total number Set frontDocument = appRef.ActiveDocument countOfLayers = frontDocument.Layers.Count If (frontDocument.Layers.Count < countOfLayers) Then MsgBox "The frontmost application only has 1 layer" Exit Sub End If Layers A collection of layers.
  • Page 360: Legacytextitem

    Visual Basic Reference Dim appRef As New Illustrator.Application Dim targetDocument As Illustrator.Document Dim targetLayer As Illustrator.Layer Dim countOfLayers As Integer Dim layerIndex As Integer Dim layerName As String Dim searchString As String searchString = "Temporary" 'loop through all open documents For Each targetDocument In appRef.Documents countOfLayers = targetDocument.Layers.Count 'For each document loop through it's layers...
  • Page 361 The tags contained in this Tags Tags collection object LegacyTextItem The top position of this Double LegacyTextItem The value of the Adobe URL tag assigned String to this LegacyTextItem The Variable bound to this VisibilityVariable Variable LegacyTextItem Variant Array (of 4...
  • Page 362 Visual Basic Reference The position of this art object within the ZOrderPosition Long stacking order of the group or layer (Parent) that contains the art object Table 5.67 LegacyTextItem — Methods Method Returns What it does If true, create text frames from all legacy ConvertToNative() Boolean text items;...
  • Page 363 Adobe Illustrator CS Scripting Guide Table 5.67 LegacyTextItem — Methods Method Returns What it does Nothing Rotates the art object relative to the Rotate( current rotation. The object is rotated Angle As Double, counter-clockwise if the Angle value is [changePositions As...
  • Page 364: Legacytextitems

    Visual Basic Reference LegacyTextItems A collection of legacy text items. Table 5.68 LegacyTextItems — Properties Property Value type What it is Application to which the collection Application Application belongs Number of elements in the collection Count Long The object’s container Parent Object Table 5.69 LegacyTextItems —...
  • Page 365 Adobe Illustrator CS Scripting Guide Table 5.71 Lines — Methods Method Returns What it does Returns the index position of the object Index(ItemPtr As TextRange) Long within the collection Returns an object reference to the object Item(ItemKey) TextRange identified by itemKey; by name or...
  • Page 366: Matrix

    Visual Basic Reference Matrix A transformation matrix specification, used to transform the geometry of objects. Table 5.72 Matrix — Properties Property Value type What it is The Illustrator Application object Application Application object Matrix property a MValueA Double Matrix property b MValueB Double Matrix property c...
  • Page 367: Meshitem

    Adobe Illustrator CS Scripting Guide Set moveMatrix = appRef.GetTranslationMatrix(72# * 0.5, 72# * 1.5) 'Add a rotation to the translation. We rotate 10 degrees counter clockwise Set totalMatrix = appRef.ConcatenateRotationMatrix(moveMatrix, 10) 'apply the transformation to all art in the document Dim artItem As Object For Each artItem In appRef.ActiveDocument.PageItems...
  • Page 368 Boolean The tags contained in this MeshItem Tags Tags collection object The top position of this MeshItem Double The value of the Adobe URL tag assigned String to this MeshItem The Variable bound to this VisibilityVariable Variant MeshItem Variant Array (of 4...
  • Page 369 Adobe Illustrator CS Scripting Guide Table 5.74 MeshItem — Methods (Continued) Method Returns What it does Duplicate an art item, optionally Duplicate( Object specifying the location and position [relativeObject As Object], for the copy [insertionLocation As AiElementPlacement]) Nothing Move an art item, specifying the new...
  • Page 370: Meshitems

    Visual Basic Reference Notes Mesh items cannot be created from a script, but can be copied and pasted. Example 37.1 This script illustrates how to lock all MeshItems in the active document. Dim appRef As New Illustrator.Application Dim meshItem As Illustrator.meshItem For Each meshItem In appRef.ActiveDocument.MeshItems meshItem.Locked = True MeshItems...
  • Page 371 Adobe Illustrator CS Scripting Guide Notes MeshItems cannot be created from a script, but can be copied and pasted. Example 38.1 The following script illustrates how to copy MeshItems from one document to another. To run this script you need to have two open documents. One document should contain at least one MeshItem, the other document can be empty.
  • Page 372: Nocolor

    Visual Basic Reference NoColor Represents the “none” color. Assignment of a reference to a NoColor object to the document’s default fill or stroke color, or those of an art item, is equivalent to setting their ‘Filled’ or ‘Stroked’ property to False. Table 5.77 NoColor —...
  • Page 373: Openoptions

    Adobe Illustrator CS Scripting Guide OpenOptions Table 5.78 OpenOptions — Properties Property Value type What it is Application that the collection Application Application belongs to If true, update all text objects for UpdateLegacyText Boolean documents saved with legacy text by Illustrator versions previous to CS;...
  • Page 374: Pageitems

    Visual Basic Reference PageItems A collection of PageItems. Table 5.79 PageItems — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The object that contains this Parent object PageItems object...
  • Page 375 Adobe Illustrator CS Scripting Guide Select Case TypeName(artItem) Case Is = "PlacedItem" fileReferences(index) = artItem.File index = index + 1 Case Is = "RasterItem" If (Not artItem.Embedded) Then fileReferences(index) = artItem.File index = index + 1 End If End Select...
  • Page 376: Paper

    Visual Basic Reference Paper A container for information about the paper to be used for printing. Table 5.81 Paper — Properties Property Value type What it is Application to which the collection Application AiApplication belongs object The paper name Name String The paper information PaperInfo...
  • Page 377: Paperinfo

    Adobe Illustrator CS Scripting Guide sText = sText & vbTab & paperRef.PaperInfo.Width sText = sText & " x " & paperRef.PaperInfo.Height & vbCrLf Next paperRef textRef.Contents = sText appRef.Redraw PaperInfo Contains information about the dimensions and imageable area of the paper to be used for printing.
  • Page 378 Visual Basic Reference Table 5.83 ParagraphAttributes — Properties (Continued) Property Value type What it is Desired glyph scaling expressed as a DesiredGlyphScaling Double percentage Desired letter spacing expressed as a DesiredLetterSpacing Double percentage Desired word spacing expressed as a DesiredWordSpacing Double percentage If true, the Every Line Composer is...
  • Page 379 Adobe Illustrator CS Scripting Guide Table 5.83 ParagraphAttributes — Properties (Continued) Property Value type What it is Minimum number of characters before a MinimumBeforeHyphen Long hyphen Minimum glyph scaling expressed as a MinimumGlyphScaling Double percentage Minimum hyphenated word size MinimumHyphenatedWord-...
  • Page 380: Paragraphs

    Visual Basic Reference Set textRef = docRef.TextFrames.AreaText(pathRef) textRef.Paragraphs.Add ("Left justified paragraph.") textRef.Paragraphs.Add ("Center justified paragraph.") textRef.Paragraphs.Add ("Right justified paragraph.") textRef.TextRange.CharacterAttributes.Size = 28 ' Change the justification of each paragraph ' using the paragraph attributes object textRef.Paragraphs(1).ParagraphAttributes.Justification = aiRight textRef.Paragraphs(2).ParagraphAttributes.Justification = aiCenter textRef.Paragraphs(3).ParagraphAttributes.Justification = aiLeft Paragraphs A collection of paragraphs.
  • Page 381: Paragraphstyle

    Adobe Illustrator CS Scripting Guide Example 45.1 This script displays the total number of paragraphs contained in all of the TextFrameItems in the current document. Dim appRef As New Illustrator.Application Dim curTextArt As Illustrator.TextFrame Dim curTextRange As Illustrator.TextRange Dim numParagraphs As Integer If appRef.Documents.Count >...
  • Page 382 Visual Basic Reference Table 5.87 ParagrahStyle— Methods Method Returns What it does Apply the paragraph style to text object(s) ApplyTo(textframe ,[ClearingOverrides as Boolean]) Nothing Delete the object Delete() Example 46.1 ' ParagraphStyles ' Create 3 simple paragraphs with different attributes ' Create a ParagraphStyle and apply it to each paragraph Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document...
  • Page 383: Paragraphstyles

    Adobe Illustrator CS Scripting Guide ParagraphStyles A collection of ParagraphStyle objects. Table 5.88 ParagraphStyles — Properties Property Value type What it is The Illustrator Application object Application Application object Number of elements in the collection Count Long The object’s container...
  • Page 384 Visual Basic Reference Table 5.90 PathItem — Properties (Continued) Property Value type What it is Is this object used to create a knockout? If ArtworkKnockout AiKnockoutState so, what kind of knockout? enumeration The mode used when compositing an BlendingMode AiBlendModes object enumeration If true, this path is to be used as a...
  • Page 385 The tags contained in this PathItem Tags Tags collection object The top position of this PathItem Double The value of the Adobe URL tag assigned String to this PathItem The Variable bound to this PathItem VisibilityVariable Variable Variant Array (of 4...
  • Page 386 Visual Basic Reference Table 5.90 PathItem — Properties (Continued) Property Value type What it is The width of the PathItem excluding Width Double stroke width, based on the GeometricBounds If true, the text frame object should be WrapInside Boolean wrapped inside this object The offset to use when wrapping text WrapOffset Double...
  • Page 387 Adobe Illustrator CS Scripting Guide Table 5.91 PathItem — Methods (Continued) Method Returns What it does Nothing Scales the art object where scaleX is the Resize( horizontal scaling factor and scaleY is scaleX As Double, the vertical scaling factor; 100.0 = 100%...
  • Page 388 Visual Basic Reference Notes The PathItem class give you complete access to paths in Illustrator. The SetEntirePath method provides an extremely efficient way to create paths which consist of straight lines. Example 47.1 This script sets the stroke color and the fill color of the first path in the frontmost document. Dim appRef As New Illustrator.Application Dim frontDocument As Illustrator.Document Dim firstPath As Illustrator.PathItem...
  • Page 389: Pathitems

    Adobe Illustrator CS Scripting Guide PathItems A collection of path art items. Table 5.92 PathItems — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The object that contains this...
  • Page 390 Visual Basic Reference Table 5.93 PathItems — Methods Method Returns What it does PathItem object Creates a new PathItem in the shape of RoundedRectangle( a rectangle with rounded corners using [top As Double], the supplied parameters [left As Double], [Width As Double], [Height As Double], [horizontalRadius As Double],...
  • Page 391: Pathpoint

    Adobe Illustrator CS Scripting Guide PathPoint A point on a specific path. Each path point is made up of an anchor point (Anchor) and a pair of handles (LeftDirection and RightDirection). Table 5.94 PathPoint — Properties Property Value type What it is Variant Array (of 2 The position of this point’s anchor point...
  • Page 392: Pathpoints

    Visual Basic Reference Dim firstPath As Illustrator.PathItem Dim currentPoint As Illustrator.PathPoint Dim nextPoint As Illustrator.PathPoint Dim countOfPoints As Integer Dim index As Integer Dim deltax, deltay, length As Double Set firstPath = appRef.ActiveDocument.PathItems(1) countOfPoints = firstPath.PathPoints.Count 'loop through all PathPoints except for the last one and set the 'left/right direction according to where the next point is For index = 1 To (countOfPoints - 1) Set currentPoint = firstPath.PathPoints(index)
  • Page 393: Pattern

    Adobe Illustrator CS Scripting Guide Table 5.97 PathPoints — Methods Method Returns What it does Returns an object reference to the object item(itemKey) PathPoint object identified by itemKey; by name or index Nothing Deletes all objects in this collection RemoveAll() Example 49.1...
  • Page 394: Patterns

    Visual Basic Reference Notes Illustrator’s Pattern object represents a pattern as defined in the Illustrator application. Example 50.1 This script illustrates how to set the default fill color of document 1 to pattern 1. Dim appRef As New Illustrator.Application Dim frontDocument As Illustrator.Document Dim PatternColor As Illustrator.PatternColor Set frontDocument = appRef.Documents(1) Set PatternColor = New Illustrator.PatternColor...
  • Page 395: Patterncolor

    Adobe Illustrator CS Scripting Guide Example 51.1 This script illustrates how to remove a pattern. Note after removing Illustrator objects you should set the variable that referenced the object you just removed to Nothing. Dim appRef As New Illustrator.Application Dim frontDocument As Illustrator.Document Dim patternToRemove As Illustrator.Pattern...
  • Page 396 Visual Basic Reference Table 5.102 PatternColor — Properties (Continued) Property Value type What it is The distance to translate the unscaled ShiftDistance Double prototype pattern before filling Notes Pattern colors are created using a reference to an existing pattern in the document. A matrix may be specified to further transform the pattern color.
  • Page 397: Pdffileoptions

    Adobe Illustrator CS Scripting Guide PDFFileOptions Class of the PDFFileOptions property of the Preferences class. Table 5.103 PDFFileOptions — Properties Property Value type What it is Application to which the collection Application Application belongs Specifies which page should be used...
  • Page 398: Pdfsaveoptions

    Visual Basic Reference PDFSaveOptions Options which may be supplied when saving a document as an Acrobat PDF file. See the Save method for additional details. Table 5.104 PDFSaveOptions — Properties Property Value type What it is If true, create PDF layers from top- AcrobatLayers Boolean level layers (Acrobat 6 only option;...
  • Page 399 Adobe Illustrator CS Scripting Guide Table 5.104 PDFSaveOptions — Properties (Continued) Property Value type What it is If true, enable accessing 128-bit; EnableAccess Boolean default: true If true, enable copying of text 128-bit; EnableCopy Boolean default: true If true, enable copying and accessing...
  • Page 400 Visual Basic Reference Table 5.104 PDFSaveOptions — Properties (Continued) Property Value type What it is Downsample if the image’s resolution is MonochromeDownsampling- Double above this value; default: 450 ImageThreshold How should monochrome bitmap MonochromeDownsampling- AiDownsampleMethod images be resampled; default: Method enumeration NoDownsample Offset from artwork to draw printer...
  • Page 401: Photoshopfileoptions

    Adobe Illustrator CS Scripting Guide Notes PDF save options can only be supplied in conjunction with the SaveAs method. It is not necessary to specify values for all properties. Default values will be provided for any properties not specified. Example 54.1 This script illustrates how to save the frontmost document as PDF.
  • Page 402: Placeditem

    Visual Basic Reference Example 55.1 ' PhotoshopFileOptions ' Open a PSD file and retain layers ' using the PhotoshopFileOptions object ' This sample assumes the "C:\temp\MultiLayer.psd" exists Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document With appRef.Preferences.PhotoshopFileOptions .PreserveLayers = True .PixelAspectRatioCorrection = False End With Set docRef = appRef.Open("C:\temp\MultiLayers.psd", aiDocumentRGBColor)
  • Page 403 The tags contained in this PlacedItem Tags Tags collection object The top position of the PlacedItem Double The value of the Adobe URL tag assigned String to this PlacedItem The Variable bound to this PlacedItem VisibilityVariable Variable Variant Array (of 4...
  • Page 404 Visual Basic Reference Table 5.107 PlacedItem — Methods Method Returns What it does Nothing Copies the art object to the clipboard; the Copy() associated document must be the frontmost document Nothing Cuts the art object onto the clipboard; the Cut() associated document must be the frontmost document Nothing...
  • Page 405 Adobe Illustrator CS Scripting Guide Table 5.107 PlacedItem — Methods (Continued) Method Returns What it does Nothing Repositions the art object relative to the Translate( current position, where deltaX is the [deltaX As Double], horizontal offset and deltaY is the vertical...
  • Page 406: Placeditems

    Visual Basic Reference PlacedItems A collection of placed art items. Table 5.108 PlacedItems — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The document that contains this Parent Document object PlacedItems object...
  • Page 407 Boolean The tags contained in this PluginItem Tags Tags collection object The top position of the PluginItem Double The value of the Adobe URL tag assigned String to this PluginItem The Variable bound to this VisibilityVariable Variable PluginItem Variant Array (of 4...
  • Page 408 Visual Basic Reference Table 5.110 PluginItem — Properties (Continued) Property Value type What it is If true, wrap text frame objects around Wrapped Boolean this object (text frame must be above the object) The position of this art object within the ZOrderPosition Long stacking order of the group or layer...
  • Page 409 Adobe Illustrator CS Scripting Guide Table 5.111 PluginItem — Methods (Continued) Method Returns What it does Nothing Transforms the art object by applying a Transform( transformation matrix transformationMatrix As Matrix, [changePositions As Boolean], [changeFillPatterns As Boolean], [changeFillGradients As Boolean], [changeStrokePattern As Boolean],...
  • Page 410: Pluginitems

    Visual Basic Reference PluginItems A collection of PluginItems in a document. Table 5.112 PluginItems — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The object that contains this Parent Layer object or object...
  • Page 411: Ppdfileinfo

    Adobe Illustrator CS Scripting Guide PPDFileInfo Information about the PPD file. Table 5.115 PPDFileInfo — Properties Property Value type What it is Application that the collection Application AiApplication belongs to object Path specification for the PPD file File String The PostScript language level...
  • Page 412: Preferences

    Visual Basic Reference textRef.Left = x appRef.Redraw y = y - textRef.Height Next ppd Preferences Specifies options for PDF and Photoshop files. Table 5.116 Preferences — Properties Property Value type What it is The Illustrator Application object Application Application object The object’s container Parent Variant...
  • Page 413: Printcolorseparationoptions

    Adobe Illustrator CS Scripting Guide ' Create a PrintColorManagementOptions object and assign it ' to a PrintOptions object, then print with each color intent ' create a simple path item and apply a graphic style to it Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document...
  • Page 414 Visual Basic Reference Example 60.1 ' PrintColorSeparationOptions ' Create a new document and add some symbol items ' Create a PrintColorSeparationOptions object and ' print with various separation settings ' Create a new document and add some artwork Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document Set docRef = appRef.Documents.Add() Dim symbolRef As Illustrator.Symbol...
  • Page 415: Printcoordinateoptions

    Adobe Illustrator CS Scripting Guide PrintCoordinateOptions This object class is a container for information about the media and associated printing parameters. Table 5.119 PrintCoordinateOptions — Properties Property Value type What it is Application to which the collection Application Application object...
  • Page 416: Printer

    Visual Basic Reference textRef.Width = docRef.Width + 100 textRef.Height = 150 appRef.Redraw ' Print the item using various settings of the ' PrintCoordinateOptions object Dim coordinateOptions As New Illustrator.PrintCoordinateOptions Dim printOptions As New Illustrator.printOptions printOptions.coordinateOptions = coordinateOptions coordinateOptions.Emulsion = True ' reverse from right to left coordinateOptions.FitToPage = True ' fit artwork to page size...
  • Page 417: Printerinfo

    Adobe Illustrator CS Scripting Guide ' of each printer and display it on the page Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document Dim textRef As Illustrator.TextFrame Dim sData As String Set docRef = appRef.Documents.Add() Set textRef = docRef.TextFrames.Add() textRef.Top = docRef.Height - 50...
  • Page 418 Visual Basic Reference Table 5.121 PrinterInfo — Properties (Continued) Property Value type What it is Custom paper’s maximum height MaxPaperHeight Double Custom paper’s maximum height offset MaxPaperHeightOffset Double Custom paper’s maximum width MaxPaperWidth Double Custom paper’s maximum width offset MaxPaperWidthOffset Double Custom paper’s minimum height MinPaperHeight...
  • Page 419: Printflatteneroptions

    Adobe Illustrator CS Scripting Guide For Each printerRef In appRef.PrinterList sPrintInfo = sPrintInfo & printerRef.Name & vbCrLf sPrintInfo = sPrintInfo & vbTab & "PS Level = " sPrintInfo = sPrintInfo & CStr(printerRef.PrinterInfo.PostScriptLevel) & vbCrLf sPrintInfo = sPrintInfo & vbTab & "Device Resolution = "...
  • Page 420 Visual Basic Reference Table 5.122 PrintFlattenerOptions — Properties (Continued) Property Value type What it is The rasterization resolution (1.0–9600.0; RasterizationResolution Double default: 300.0) Example 64.1 ' PrintFlattenerOptions ' Open a document, and add a simple text frame ' with a graphic style applied. ' Print the document with "low"...
  • Page 421: Printfontoptions

    Adobe Illustrator CS Scripting Guide PrintFontOptions This object class contains information about font downloading and substitution for the fonts used for printing the document. Table 5.123 PrintFontOptions — Properties Property Value type What it is Application to which the collection...
  • Page 422: Printjoboptions

    Visual Basic Reference PrintJobOptions Contains information about how the job is to be printed. Table 5.124 PrintJobOptions — Properties Property Value type What it is Application to which the collection Application Application object belongs The bitmap resolution; minimum 0.0; BitmapResolution Double default: 0.0 If true, collate print pages;...
  • Page 423 Adobe Illustrator CS Scripting Guide Dim layerRef_3 As Illustrator.Layer ' create a visible, printable item Set textRef_1 = docRef.Layers(1).TextFrames.Add() textRef_1.Contents = "Visible and Printable" textRef_1.Top = 600 textRef_1.Left = 200 ' create a visible, non-printable item Set layerRef_2 = docRef.Layers.Add() Set textRef_2 = layerRef_2.TextFrames.Add()
  • Page 424: Printoptions

    Visual Basic Reference PrintOptions PrintOptions contains information about all printing options including flattening, color management, coordinates, fonts, and paper. Table 5.125 PrintOptions — Properties Property Value type What it is Application to which the collection Application Application object belongs The printing color management options ColorManagementOptions PrintColorManage- mentOptions object...
  • Page 425 Adobe Illustrator CS Scripting Guide ' with the combined PrintOptions object. Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document Set docRef = appRef.Documents.Add() Dim symbolRef As Illustrator.Symbol Dim itemRef As Illustrator.SymbolItem Dim y As Integer dim i as Integer y = docRef.Height - 30...
  • Page 426: Printpagemarksoptions

    Visual Basic Reference PrintPageMarksOptions PrintPageMarksOptions is used to specify the options for the page marks. Table 5.126 PrintPageMarksOptions — Properties Property Value type What it is Application to which the collection Application Application object belongs Variant(array of 4 The bleed offset rect BleedOffsetRect doubles) If true, enable color bars printing...
  • Page 427: Printpaperoptions

    Adobe Illustrator CS Scripting Guide docRef.GraphicStyles(2).ApplyTo pathItem ' Create a PrintCoordinateOptions object and assign it ' to a PrintOptions object Dim pageMarksOpts As New Illustrator.PrintPageMarksOptions pageMarksOpts.ColorBars = True pageMarksOpts.PageInfoMarks = True pageMarksOpts.RegistrationMarks = True pageMarksOpts.TrimMarks = True Dim printerOpts As New Illustrator.printOptions printerOpts.PageMarksOptions = pageMarksOpts...
  • Page 428: Printpostscriptoptions

    Visual Basic Reference PrintPostScriptOptions Specifies the options to be used when printing to a PostScript printer. Table 5.128 PrintPostScriptOptions — Properties Property Value type What it is Application that the collection belongs to Application Application object If true, print in binary mode; BinaryPrinting Boolean default: false...
  • Page 429: Rasteritem

    Adobe Illustrator CS Scripting Guide Dim psOpts As New Illustrator.PrintPostScriptOptions Dim printOpts As New Illustrator.printOptions printOpts.PostScriptOptions = psOpts ' print with different PS levels psOpts.PostScriptLevel = aiPSLevel2 docRef.PrintOut printOpts psOpts.PostScriptLevel = aiPSLevel3 docRef.PrintOut printOpts RasterItem A bitmap art object in a document.
  • Page 430 The tags contained in this raster art item Tags Tags collection object The top position of the RasterItem Double The value of the Adobe URL tag assigned String to this RasterItem The Variable that is bound to this VisibilityVariable Variable...
  • Page 431 Adobe Illustrator CS Scripting Guide Table 5.129 RasterItem — Properties (Continued) Property Value type What it is The position of this art object within the ZOrderPosition Long stacking order of the group or layer (Parent) that contains the art object Table 5.130 RasterItem —...
  • Page 432 Visual Basic Reference Table 5.130 RasterItem — Methods (Continued) Method Returns What it does Nothing Transforms the art object by applying a Transform( transformation matrix transformationMatrix As Matrix, [changePositions As Boolean], [changeFillPatterns As Boolean], [changeFillGradients As Boolean], [changeStrokePattern As Boolean], [changeLineWidths As Double], [transformAbout As AiTransformation])
  • Page 433: Rasteritems

    Adobe Illustrator CS Scripting Guide RasterItems A collection of raster art items. Table 5.131 RasterItems — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The object that contains this...
  • Page 434: Rgbcolor

    Visual Basic Reference RGBColor A RGB color specification, used to apply an RGB color to a layer or art item. Table 5.133 RGBColor — Properties Property Value type What it is The Illustrator Application object Application Application object The blue color value as a value in the Blue Double range 0.0–255.0...
  • Page 435: Screen

    Adobe Illustrator CS Scripting Guide Screen Screen contains all information about the screen to be used for printing. Table 5.134 Screen — Properties Property Value type What it is Application to which the collection belongs Application Application object The color separation screen...
  • Page 436: Screeninfo

    Visual Basic Reference ScreenInfo ScreenInfo contains infor mation about the angle and frequency of the screen to be used for printing. Table 5.135 ScreenInfo — Properties Property Value type What it is The screen’s angle (in degrees) Angle Double The Application to which the Application Application object collection belongs...
  • Page 437: Spot

    Adobe Illustrator CS Scripting Guide Dim textRef As Illustrator.TextFrame Set docRef = appRef.Documents.Add() Set textRef = docRef.TextFrames.Add() textRef.Top = 600 textRef.Left = 50 textRef.Contents = "ScreenSpotFunctions for 1st PPD:" & vbCrLf ' Get the first PPD Dim ppdRef As Illustrator.PPDFile Set ppdRef = appRef.PPDFileList(1)
  • Page 438 Visual Basic Reference Notes Illustrator’s Spot object represents a spot color as defined by Illustrator. All Illustrator documents contain the spot color “[Registration]” which can be used to print to all plates of a separation. If no properties are specified when creating a new spot, default properties will be provided. However, if specifying the color, you must use the same color space as the document, either CMYK or RGB.
  • Page 439: Spots

    Adobe Illustrator CS Scripting Guide Spots A collection of spot colors in a document. Table 5.139 Spots — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count...
  • Page 440: Spotcolor

    Visual Basic Reference SpotColor Color class used to apply the color value of a spot at a specified tint value. Table 5.141 SpotColor — Properties Property Value type What it is The Illustrator Application object Application Application object A reference to the SpotColor object Spot Spot object which defines the color...
  • Page 441: Story

    Adobe Illustrator CS Scripting Guide Dim newSpotColor As New Illustrator.SpotColor newSpotColor.Spot = newSpot newSpotColor.Tint = 50# Set frontPath = frontDocument.PathItems(1) frontPath.Filled = True Story A contiguous block of text with a specified text range. A story can contain one or more text frames;...
  • Page 442: Stories

    Visual Basic Reference Dim docRef As Illustrator.Document Set docRef = appRef.Documents.Add() Dim storyRef1 As Illustrator.Story Dim storyRef2 As Illustrator.Story Dim textRef1 As Illustrator.TextFrame Dim textRef2 As Illustrator.TextFrame Dim itemRef1 As Illustrator.pathItem Dim itemRef2 As Illustrator.pathItem ' Create the first text frame Set itemRef1 = docRef.PathItems.Rectangle(600, 200, 50, 30) Set textRef1 = docRef.TextFrames.AreaText(itemRef1) textRef1.Selected = True...
  • Page 443: Swatch

    Adobe Illustrator CS Scripting Guide Table 5.144 Stories — Methods Method Returns What it does Returns the index position of the object Index(ItemPtr as Story) Long within the collection Returns an object reference to the object Item(ItemKey) Story identified by itemKey; by name or index Note: See Example 78.1 for a sample script which uses the Stories class.
  • Page 444: Swatches

    Visual Basic Reference Example 79.1 This script illustrates how to change the name of the fifth swatch. Dim appRef As New Illustrator.Application Dim swatch5 As Illustrator.Swatch Set swatch5 = appRef.ActiveDocument.Swatches(5) Swatches A collection of swatches in a document. Table 5.147 Swatches — Properties Property Value type What it is...
  • Page 445: Symbol

    Adobe Illustrator CS Scripting Guide Symbol A Symbol is an ArtObject that is stored in the Symbols Palette, and can be reused one or more times in the document without duplicating the art data. Symbols are contained in documents. Instances of Symbols in a document are SymbolItems.
  • Page 446 Visual Basic Reference Table 5.151 Symbols — Properties Property Value type What it is The document that contains this Parent Document object Symbols object Table 5.152 Symbols — Methods Method Returns What it does Creates a new symbol in the document Add(SourceArt As Object) Symbol object based on an art item...
  • Page 447: Symbolitem

    Adobe Illustrator CS Scripting Guide ' create a new symbol from the graphic style docRef.Symbols.Add itemRef y = (y - (itemRef.Height + 40)) ' reduce y for next item i = i + 1 Loop appRef.Redraw MsgBox "There are now " + CStr(docRef.Symbols.Count) + " symbols."...
  • Page 448 SymbolItem The tags contained in this SymbolItem Tags Tags collection object The top position of the SymbolItem Double The value of the Adobe URL tag assigned String to this SymbolItem The Variable bound to this VisibilityVariable Variable SymbolItem Variant Array (of 4...
  • Page 449 Adobe Illustrator CS Scripting Guide Table 5.154 SymbolItem — Methods Method Returns What it does Nothing Copies the SymbolItem to the Copy() clipboard; the associated document must be the frontmost document Nothing Cuts the SymbolItem to the clipboard; Cut() the associated document must be the frontmost document.
  • Page 450 Visual Basic Reference Table 5.154 SymbolItem — Methods (Continued) Method Returns What it does Nothing Repositions the SymbolItem relative to Translate( the current position, where deltaX is the [deltaX As Double], horizontal offset and deltaY is the [deltaY As Double], vertical offset [transformObjects As Boolean], [transformFillPatterns As Boolean],...
  • Page 451: Symbolitems

    Adobe Illustrator CS Scripting Guide y = y - (itemRef.Height + 20) If (y < 60) Then y = docRef.Height - 30 x = x + 200 End If i = i + 1 Loop SymbolItems A collection of swatches in a document.
  • Page 452: Tabstopinfo

    Visual Basic Reference TabStopInfo TabStopInfo specifies information about the alignment, position, and other details for the tab stop. Table 5.157 TabStopInfo — Properties Property Value type What it is The alignment of the tab stop (default: Alignment AiTabStopAlignment enumeration LeftTab) Application that the collection Application AiApplication...
  • Page 453 Adobe Illustrator CS Scripting Guide Notes Tags allows you to assign an unlimited number of key-value pairs to any item in a document. Example 83.1 This example illustrates how to list the tags associated with the first selected item. The name and value of the tags are listed in a new document.
  • Page 454: Tags

    Visual Basic Reference Tags A collection of tags. Table 5.160 Tags — Properties Property Value type What it is The Illustrator Application object Application Application object The number of objects in the collection Count Long The object that contains this Tags object Parent object Table 5.161 Tags —...
  • Page 455: Textfont

    Adobe Illustrator CS Scripting Guide TextFont Information about a font in the document. Table 5.162 TextFont — Properties Property Value type What it is Application that the collection Application Application belongs to The font’s text face name Name String The object’s container...
  • Page 456: Textfonts

    Visual Basic Reference TextFonts A collection of TextFont objects. Table 5.163 TextFonts — Properties Property Value type What it is Application to which the collection Application Application belongs Number of elements in the collection Count Long The object’s container Parent Object Table 5.164 TextFonts —...
  • Page 457: Textframe

    Adobe Illustrator CS Scripting Guide TextFrame A TextFrame object contained in a Story; there may be more than one TextFrame if the text is area text. Table 5.165 TextFrame — Properties Property Value type What it is The position of the anchor point along...
  • Page 458 Visual Basic Reference Table 5.165 TextFrame — Properties (Continued) Property Value type What it is The left position of the art item Left Double All the lines in this text range Lines Lines If true, this artwork item is locked Locked Boolean The item’s name...
  • Page 459 Table 5.165 TextFrame — Properties (Continued) Property Value type What it is True top position of the art item Double True value of the Adobe URL tag assigned String to this artwork item True visibility variable bound to this page VisibilityVariable Variant...
  • Page 460 Visual Basic Reference Table 5.166 TextFrame — Methods (Continued) Method Returns What it does Scale art object(s) Resize( ScaleX As Double, ScaleY As Double, [ChangePositions], [ChangeFillPatterns], [ChangeFillGradients], [ChangeStrokePattern], [ChangeLineWidths], [ScaleAbout]) Rotate art object(s) Rotate( Angle As Double, [ChangePositions], [ChangeFillPatterns], [ChangeFillGradients], [ChangeStrokePattern], [RotateAbout]) Transform art object(s) using a...
  • Page 461: Textframes

    Adobe Illustrator CS Scripting Guide Dim textArtGroup As Illustrator.TextFrames 'First check the selection of the application 'It has to be a text art item in order for this script to run selection = appRef.selection If (IsEmpty(selection)) Then MsgBox "Select a text item before running this script"...
  • Page 462 Visual Basic Reference Table 5.168 TextFrames — Methods Method Returns What it does Ceate a point text frame item Add() TextFrame Create an area text frame item AreaText( TextFrame TextPath As PathItem, [Orientation], [BaseFrame], [PostFix]) Returns the index position of the object Index(ItemPtr As TextFrame) Long within the collection...
  • Page 463 Adobe Illustrator CS Scripting Guide Set rectRef = docRef.PathItems.Rectangle(700, 50, 100, 100) Dim areaTextRef As Illustrator.TextFrame Set areaTextRef = docRef.TextFrames.AreaText(rectRef) areaTextRef.Contents = "TextFrame #1" areaTextRef.Selected = True ' Line Text Dim lineRef As Illustrator.pathItem Set lineRef = docRef.PathItems.Add() lineRef.SetEntirePath (Array(Array(200, 700), Array(300, 550))) Dim pathTextRef As Illustrator.TextFrame...
  • Page 464: Textrange

    Visual Basic Reference TextRange A range of characters from a text item (story, text frame, character, word, line, paragraph, or another text range). Table 5.169 TextRange — Properties Property Value type What it is The Illustrator Application object Application Application object CharacterAttributes The character properties for the text CharacterAttributes range...
  • Page 465 Adobe Illustrator CS Scripting Guide Table 5.170 TextRange — Methods (Continued) Method Returns What it does Deselect the text range DeSelect() Duplicate an art item, optionally Duplicate( TextRange specifying the location and position for [relativeObject As the copy Object], [insertionLocation...
  • Page 466: Textranges

    Visual Basic Reference 'character number charsToChange. Note the first character in a 'TextRange has an index of 0. We therefore have to subtract 1 Set firstChars = textWord.TextRange(, charsToChange - 1) firstChars.Size = firstChars.Size * 1.5 End If Next TextRanges A collection of text range items.
  • Page 467: Variables

    Adobe Illustrator CS Scripting Guide Table 5.173 Variable — Properties (Continued) Property Value type What it is All of the artwork in this document PageItems PageItems object The document that contains this Parent Document object Variable Table 5.174 Variable — Methods...
  • Page 468: View

    Visual Basic Reference View A document view in an Illustrator document. Table 5.177 View — Properties Property Value type What it is The Illustrator Application object Application Application object Variant Array (of 4 The bounding rectangle of this View Bounds Doubles) relative to the current document’s bounds...
  • Page 469: Views

    Adobe Illustrator CS Scripting Guide Views A collection of views in a document. Table 5.178 Views — Properties Property Value type What it is The Illustrator Application object Application Application object Long The number of objects in the collection Count...
  • Page 470: Words

    Visual Basic Reference Words A collection of words. Table 5.180 Words — Properties Property Value type What it is Application to which the collection Application Application belongs Number of elements in the collection Count Long True object’s container Parent Object Table 5.181 Words —...
  • Page 471: Enumerations Reference

    Adobe Illustrator CS Scripting Guide Enumerations reference Enumeration type: Values: What it means: AiAlternateGlyphsForm aiDefaultForm aiTraditional aiExpert aiJIS78Form aiJIS83Form aiHalfWidth aiThirdWidth aiQuarterWidth aiFullWidth aiProportionalWidth AiAutoKernType aiNoAutoKern aiAuto aiOptical AiAutoLeadingType aiBottomToBottom aiTopToTop AiBaselineDirectionType aiStandardBaseline aiTateChuYokoBaseline aiVerticalRotatedBaseline 12 Aug 03...
  • Page 472 Visual Basic Reference Enumeration type: Values: What it means: The blend mode used when AiBlendModes aiColorBlend compositing an object aiColorBurn aiColorDodge aiDarken aiDifference aiExclusion aiHardLight aiHue aiLighten aiLuminosity aiMultiply aiNormalBlend aiOverlay aiSaturation aiScreen aiSoftLight AiBurasagariTypeEnum aiBurasagariNone aiBurasagariStandard aiBurasagariForced AiCaseChangeType aiUpperCase aiLowerCase aiTitleCase aiSentenceCase...
  • Page 473 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: AiColorModel aiRegistration aiProcess aiSpot The method used to reduce AiColorReductionMethod aiAdaptive the number of colors in aiPerceptual exported GIF and PNG8 aiSelective images aiWeb The version of the Illustrator...
  • Page 474 Visual Basic Reference Enumeration type: Values: What it means: aiJPEGHigh The quality of bitmap AiCompressionQuality compression used when aiJPEGLow saving a PDF file aiJPEGMaximum aiJPEGMedium aiJPEGMinimum aiNoCompression aiZIP4Bit aiZIP8Bit aiAutomaticJPEGMinimum aiAutomaticJPEGLow aiAutomaticJPEGMedium aiAutomaticJPEGHigh aiAutomaticJPEGMaximum aiAutomaticJPEG2000Minimum aiAutomaticJPEG2000Low aiAutomaticJPEG2000Medium aiAutomaticJPEG2000High aiAutomaticJPEG2000Maximum aiAutomaticJPEG2000Lossless aiJPEG2000Minimum aiJPEG2000Low aiJPEG2000Medium...
  • Page 475 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: AiDownsampleMethod aiNoDownsample aiAverageDownsample aiSubsample aiBicubicDownsample AiElementPlacement aiPlaceInside aiPlaceAtBeginning aiPlaceAtEnd aiPlaceBefore aiPlaceAfter Specifies the PostScript level AiEPSPostScriptLevel- aiLevel2 to use when saving an EPS file Enum aiLevel3 The preview image format...
  • Page 476 Visual Basic Reference Enumeration type: Values: What it means: AiFlashImageFormat aiLossless aiLossy AiFlashJPEGMethod aiJPEGStandard aiJPEGOptimized AiFontBaselineOption aiNormalBaseline aiSuperScript aiSubScript AiFontCapsOption aiNormalCaps aiSmallCaps aiAllCaps aiAllSmallCaps AiFontOpenTypePosition- aiOpenTypeDefault Option aiOpenTypeSuperScript aiOpenTypeSubScript aiNumerator aiDenominator AiFontSubstitution- aiSubstituteOblique Policy aiSubstituteTint aiSubstituteDevice The type of the gradient, AiGradientType aiLinearGradient radial or linear...
  • Page 477 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: AiJavaScriptExecution- aiNeverShowDebugger Mode aiDebuggerOnError aiBeforeRunning The alignment or justification AiJustification aiCenter for a paragraph of text aiLeft aiRight aiFullJustifyLastLineLeft aiFullJustifyLastLineRight aiFullJustifyLastLineCenter aiFullJustify AiKinsokuOrderEnum aiPushIn aiPushOutFirst aiPushOutOnly The type of knockout to use...
  • Page 478 Visual Basic Reference Enumeration type: Values: What it means: AiLanguageType aiEnglish aiFinnish aiStandardFrench aiCanadianFrench aiStandardGerman aiOldGerman aiSwissGerman aiItalian aiBokmalNorwegian aiNynorskNorwegian aiStandardPortuguese aiBrazillianPortuguese aiSpanish aiSwedish aiUKEnglish aiDutch aiDanish aiCatalan aiRussian aiUkranian aiBulgarian aiSerbian aiCzech aiPolish aiRumanian aiGreek aiTurkish aiIcelandic aiHungarian aiChinese aiJapanese 12 Aug 03...
  • Page 479 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: The type of monochrome AiMonochromeCompression aiCCIT3 bitmap compression to use aiCCIT4 when saving a PDF aiMonoZIP aiNoMonoCompression aiRunLength Specifies how transparency AiOutputFlattening aiPreserveAppearance should be flattened when aiPreservePaths saving EPS and Illustrator file...
  • Page 480 Visual Basic Reference Enumeration type: Values: What it means: AiPDFBoxType aiPDFArtBox aiPDFCropBox aiPDFTrimBox aiPDFBleedBox aiPDFMediaBox aiPDFBoundingBox AiPDFChangesAllowedEnum aiChange128None aiChange128EditPage aiChange128FillForm aiChange128Commenting aiChange128AnyChanges aiChange40None aiChange40PageLayout aiChange40Commenting aiChange40AnyChanges The version of the Acrobat file AiPDFCompatibility aiAcrobat4 format to create when saving aiAcrobat5 a PDF file aiAcrobat6 AiPDFOverprint...
  • Page 481 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: AiPolarityValues aiPositive = 1 aiNegative = –1 AiPostScriptImageCom- aiImageCompressionNone pressionType aiImageCompressionRLE aiImageCompressionJPEG AiPrintArtworkDesig- aiVisiblePrintableLayers nation aiVisibleLayers aiAllLayers AiPrintColorIntent aiPerceptualIntent aiSaturationIntent aiRelativeColorimetric aiAbsoluteColorimetric AiPrintColorProfile aiOldstyleProfile aiSourceProfile aiPrinterProfile aiCustomProfile AiPrintColorSeparation- aiComposite...
  • Page 482 Visual Basic Reference Enumeration type: Values: What it means: AiPrintingBounds aiArtboardBounds aiArtworkBounds aiCropBounds AiPrintOrientation aiPortrait aiLandscape aiReversePortrait aiReverseLandscape AiPrintPosition aiTranslateTopLeft aiTranslateTop aiTranslateTopRight aiTranslateLeft aiTranslateCenter aiTranslateRight aiTranslateBottomLeft aiTranslateBottom aiTranslateBottomRight AiPrintTiling aiTileSingleFullPage aiTileFullPages aiTileImageableAreas The status of a raster item’s AiRasterLinkState aiDataFromFile linked image, if the image is aiDataModified stored externally...
  • Page 483 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: The mode of display for a AiScreenMode aiDesktop view aiFullScreen aiMultiWindow The type of line capping for a AiStrokeCap aiButtEndCap path stroke aiProjectingEndCap aiRoundEndCap The type of joints for a path...
  • Page 484 Visual Basic Reference Enumeration type: Values: What it means: The orientation of text in a AiTextOrientation aiHorizontal TextFrameItem aiVertical The type of text art displayed AiTextType aiAreaText by this object aiPathText aiPointText The point to use as the AiTransformation aiTransformBottom anchor point about which an aiTransformBottomLeft object is rotated, resized or...
  • Page 485 Adobe Illustrator CS Scripting Guide Enumeration type: Values: What it means: AiWariChuJustification- aiWariChuLeft Type aiWariChuRight aiWariChuCenter aiWariChuFullJustifyLast- LineLeft aiWariChuFullJustifyLast- LineRight aiWariChuFullJustifyLast- LineCenter aiWariChuAutoJustify The method used to arrange aiBringForward an art object’s position in the AiZOrderMethod aiBringToFront stacking order of its parent...
  • Page 486 Visual Basic Reference 12 Aug 03...
  • Page 487: Chapter 6: Changes Since Earlier Versions

    Changes Since Earlier Versions Changes InThe Object Model for Illustrator CS Macintosh / AppleScript • Properties and method return types which had been type ‘string’ are now ‘Unicode text’ . This should only affect code which formally checks the class of the returned value. Usability should be otherwise unaffected.
  • Page 488 Changes InThe Object Model for Illustrator CS Properties which had previously been of type Illustrator.Color because they might hold one of several specific color types, such as Document.FillColor, PathItem.StrokeColor, etc. are now type Object. The current run-time type of the reference is now obtained using TypeName(objectRef).
  • Page 489: Deprecated

    Adobe Illustrator 10 Scripting Guide Deprecated Several features no longer appear in the type library when viewed using a browser such as Visual Basic's Object Browser, but are still available in this release in order to avoid breaking existing user code: •...
  • Page 490 Changes InThe Object Model for Illustrator CS 12 Aug 03...
  • Page 491: Chapter : Bibliography

    Bibliography AppleScript “Adobe Illustrator Scripting; with Visual Basic and AppleScript, ” Ethan Wilde, Peachpit Press, 2003. ISBN 0-321-11251-2. (For Illustrator 10). “AppleScript for the Internet: Visual QuickStart Guide, ” 1st ed., Ethan Wilde, Peachpit Press, 1998. ISBN 0-201-35359-8. “AppleScript Language Guide: English Dialect, ” 1st ed., Apple Computer, Inc., Addison-Wesley Publishing Co., 1993.
  • Page 492: Internet Resources

    Internet resources Internet resources Adobe Systems, Inc. Adobe Solutions Network website: http://partners.adobe.com/asn AppleScript Apple Computer, Inc. AppleScript website www.apple.com/applescript Visual Basic Microsoft Developers Network (MSDN) scripting website msdn.microsoft.com/scripting...

This manual is also suitable for:

Illustrator cs

Table of Contents