Adding Features To "Hello World - Adobe 26001360 - Illustrator CS - PC Manual

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

Advertisement

40
In VBScript you must use integer values instead of the enumeration. (See the
"Enumerations reference" section in
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:
'Hello World! script
Dim appRef
Dim documentRef
Dim SampleText
'Create a new document and assign it to a variable
Set appRef = CreateObject("Illustrator.Application")
Set documentRef = appRef.Documents.Add
'Create a new text frame item and assign it to a variable
Set SampleText = documentRef.TextFrameItems.Add
'Set the contents and position of the TextFrameItem
SampleText.Position = Array(200, 200)
SampleText.Contents = "Hello World!"
To run this script create a text file and copy the script into it. Save the file with a "vbs" extension.
If you have Windows Scripting Host installed, you can double-click on the file to execute the
script.
Another way to execute the script is to choose File > Scripts > Browse from the Scripts menu
in Illustrator and select the file.

Adding features to "Hello World"

Next, let's create a new script that makes changes to the Illustrator document you created with
your first script. Don't worry if you've closed the Illustrator document without saving it—just
run your script to create a new one.
Our second script will demonstrate how to:
1. Get the active document.
2. Get the width of the active document.
"Visual Basic Reference" on page 287
12 Aug 03
Scripting Illustrator
to find

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs

Table of Contents