Adobe Illustrator CS Scripting Guide
Your first Illustrator script
The traditional first project in any programming language is to display the message "Hello
World!" In this example, we'll create a new Illustrator document, then add a text frame item
containing this message.
Creating an AppleScript script
To create an AppleScript script follow these steps:
1. Locate and open Script Editor.
Enter the following script. The lines preceded by "--" are comments, and will be
2.
ignored by the scripting system. They're included to document the operation of the
script. As you look through the script, you'll see how we create, then address, each
object in turn. The AppleScript command tell indicates the object that will receive
the next message we send.
-- Send the following commands to Illustrator
tell application "Adobe Illustrator CS"
-- Create a new document with the string "Hello World"
set docRef to make new document
set textRef to make new text frame item in docRef ¬
with properties {contents: "Hello World!", position:{200, 200}}
end tell
3. Run the script. Illustrator will create a new document, add a text frame at position
(200, 200) and set the text to "Hello World!".
Creating a Visual Basic 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.
2. Add a form to the project.
3. Create a new button on the form. Double-click the button to open the Code window.
12 Aug 03
37