Scripting With Vbscript; For More Information; Your First Illustrator Script - Adobe 65010248 - Illustrator CS4 - PC Manual

Scripting guide
Hide thumbs Also See for 65010248 - Illustrator CS4 - PC:
Table of Contents

Advertisement

6

Scripting with VBScript

This chapter uses script examples and explanations to help you to become familiar with Illustrator
scripting using VBScript.

For more information

Several extended sample scripts are in the
installation directory.
For information about individual classes, objects, properties, methods, and parameters, as well as script
samples that demonstrate how to use many of these items, see Adobe Illustrator CS Scripting Reference:
VBScript, in the
can view the Illustrator CS4 type library from most VBScript editors or any Microsoft Office application; see
"Viewing the VBScript object model" on page
If you do not understand the concepts and terms used in this chapter, read Adobe Introduction to Scripting.

Your first Illustrator script

The traditional first project in any programming language is displaying the message "Hello World!" Follow
these steps:
1. Start any text editor (for example, Notepad).
2. Type the following code:
Rem Hello World
Set appRef = CreateObject("Illustrator.Application")
Rem Create a new document and assign it to a variable
Set documentRef = appRef.Documents.Add
Rem Create a new text frame item and assign it to a variable
Set sampleText = documentRef.TextFrames.Add
Rem Set the contents and position of the TextFrame
sampleText.Position = Array(200, 200)
sampleText.Contents = "Hello World!"
3. Save the file as text-only in a folder of your choice, using the file extension
4. To test the script, do one of the following:
Double-click the file.
Start Illustrator, choose File > Scripts > Other Scripts, and navigate to and run your script file.
T
: To add the script to the Illustrator Scripts menu (File > Scripts), save the script in the Scripts folder. The
IP
script will appear on the menu the next time you start Illustrator. For details, see
Scripts menu" on page
dialogs will not display correctly.
msgBox
/Scripting/Documentation
10. In general, when you launch a VBScript script from the Scripts menu, any
/Scripting/Sample Scripts
folder in your Illustrator CS4 installation directory. You also
9.
folder in your Illustrator CS4
.
.vbs
"Installing scripts in the
48

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs4

Table of Contents