EDOBE XDOM TPC Technical Information Page 55

  • Download
  • Add to my manuals
  • Print
  • Page
    / 68
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 54
55
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 /Scripting/Sample Scripts folder in your Illustrator CS5
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
/Scripting/Documentation folder in your Illustrator CS5 installation directory. You also
can view the Illustrator CS5 type library from most VBScript editors or any Microsoft Office application; see
Viewing the VBScript object model” on page 10.
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 .vbs.
4. To test the script, do one of the following:
X Double-click the file.
X Start Illustrator, choose File > Scripts > Other Scripts, and navigate to and run your script file.
T
IP: To add the script to the Illustrator Scripts menu (File > Scripts), save the script in the Scripts folder. The
script will appear on the menu the next time you start Illustrator. For details, see
Installing scripts in the
Scripts menu” on page 10. In general, when you launch a VBScript script from the Scripts menu, any
msgBox dialogs will not display correctly.
Page view 54
1 2 ... 50 51 52 53 54 55 56 57 58 59 60 ... 67 68

Comments to this Manuals

No comments