Adobe 65010248 Scripting Guide - Page 25

Scripting Illustrator, Launching and quitting Illustrator from a script

Page 25 highlights

3 Scripting Illustrator This chapter is an overview of how to use scripting objects to program Illustrator CS4. Specific examples for the supported scripting languages are in succeeding chapters. Launching and quitting Illustrator from a script Your scripts can control the activation and termination of Illustrator. Launching and activating Illustrator AppleScript In AppleScript, you use a tell statement to target Illustrator. The activate command activates Illustrator if it is not already active. tell application "Adobe Illustrator" activate end tell JavaScript Typically, you run JavaScript scripts from the application's Scripts menu (File > Scripts) or start-up folder, so there is no need to launch Illustrator from your script. Information on launching Illustrator in JavaScript is beyond the scope of this guide. For details, search for "interapplication messaging" or "JavaScript messaging framework" in JavaScript Tools Guide. VBScript In VBScript, there are several ways to create an instance of Illustrator: ➤ CreateObject launches Illustrator as an invisible application if it is not already running. If Illustrator is launched as an invisible application you must manually activate the application to make it visible: Set appRef = CreateObject("Illustrator.Application") If you have multiple versions of Illustrator installed on the same machine and use the CreateObject method to obtain an application reference, using "Illustrator.Application" creates a reference to the latest Illustrator version. To specifically target an earlier version, use a version identifier at the end of the string: For Illustrator 10, use "Illustrator.Application.1" For Illustrator CS, use "Illustrator.Application.2" For Illustrator CS2, use "Illustrator.Application.3" For Illustrator CS3, use "Illustrator.Application.4" For Illustrator CS4, use "Illustrator.Application.CS4" 25

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

25
3
Scripting Illustrator
This chapter is an overview of how to use scripting objects to program Illustrator CS4. Specific examples
for the supported scripting languages are in succeeding chapters.
Launching and quitting Illustrator from a script
Your scripts can control the activation and termination of Illustrator.
Launching and activating Illustrator
AppleScript
In AppleScript, you use a
tell
statement to target Illustrator. The
activate
command activates Illustrator
if it is not already active.
tell application "Adobe Illustrator"
activate
end tell
JavaScript
Typically, you run JavaScript scripts from the application’s Scripts menu (File > Scripts) or start-up folder, so
there is no need to launch Illustrator from your script.
Information on launching Illustrator in JavaScript is beyond the scope of this guide. For details, search for
“interapplication messaging” or “JavaScript messaging framework” in
JavaScript Tools Guide
.
VBScript
In VBScript, there are several ways to create an instance of Illustrator:
CreateObject
launches Illustrator as an invisible application if it is not already running. If Illustrator is
launched as an invisible application you must manually activate the application to make it visible:
Set appRef = CreateObject("Illustrator.Application")
If you have multiple versions of Illustrator installed on the same machine and use the
CreateObject
method to obtain an application reference, using
"Illustrator.Application"
creates a reference
to the latest Illustrator version. To specifically target an earlier version, use a version identifier at the
end of the string:
For Illustrator 10, use
"Illustrator.Application.1"
For Illustrator CS, use
"Illustrator.Application.2"
For Illustrator CS2, use
"Illustrator.Application.3"
For Illustrator CS3, use
"Illustrator.Application.4"
For Illustrator CS4, use
"Illustrator.Application.CS4"