Adobe 65010248 Scripting Guide - Page 26

Quitting Illustrator, AppleScript, JavaScript, Working with objects

Page 26 highlights

CHAPTER 3: Scripting Illustrator Working with objects 26 ➤ Use the New operator if you added a reference to the Illustrator type library to the project. For example, the following line creates a new reference to the Application object: Set appRef = New Illustrator.Application Quitting Illustrator AppleScript Use the quit command: tell application "Adobe Illustrator" quit end tell JavaScript Use the app.quit() method: app.quit() VBScript Use the Application object's Quit method: Set appRef = CreateObject("Illustrator.Application") appRef.Quit Working with objects Getting the frontmost document or layer To refer to the selected document, use the application object's current document property in AppleScript or the active document property in JavaScript or VBScript. Similarly, you can use the document object's current layer or active layer property to refer to the selected layer. There are other types of "active" or "current" object properties, like active dataset or active view. For details, see the Adobe Illustrator CS4 Scripting Reference for your language. Creating new objects Several objects (besides the application object itself ) cannot be obtained from containers or parent objects. Your script must create these objects directly.

  • 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

C
HAPTER
3: Scripting Illustrator
Working with objects
26
Use the
New
operator if you added a reference to the Illustrator type library to the project. For example,
the following line creates a new reference to the
Application
object:
Set appRef = New Illustrator.Application
Quitting Illustrator
AppleScript
Use the
quit
command:
tell application "Adobe Illustrator"
quit
end tell
JavaScript
Use the
app.quit()
method:
app.quit()
VBScript
Use the
Application
object’s
Quit
method:
Set appRef = CreateObject("Illustrator.Application")
appRef.Quit
Working with objects
Getting the frontmost document or layer
To refer to the selected document, use the
application
object’s
current
document
property in
AppleScript or the
active
document
property in JavaScript or VBScript. Similarly, you can use the
document
object’s
current
layer
or
active
layer
property to refer to the selected layer.
There are other types of “active” or “current” object properties, like
active
dataset
or
active
view
. For
details, see the
Adobe Illustrator CS4 Scripting Reference
for your language.
Creating new objects
Several objects (besides the
application
object itself) cannot be obtained from containers or parent
objects. Your script must create these objects directly.