Adobe 65014293 Scripting Guide - Page 16

Additional objects, Constants, Introduction to Scripting, comment

Page 16 highlights

CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 16 Additional objects The Photoshop object model includes additional objects beyond the ones described in the containment hierarchy above. Most of these classes are used as types for properties or to provide information (as arguments) for commands or methods. For example: ➤ The color value (SolidColor/SolidColor) class provides the type for the background color (backgroundColor/backgroundColor) and foreground color (ForegroundColor/foregroundColor) properties of the Application object. See "Working with color objects" on page 51. ➤ Open and save options for documents are defined as classes, and these are passed to the commands that open and save documents; e.g., the BMP save options (BMPSaveOptions/BMPSaveOptions) class can be passed as an argument to the save (saveAs/saveAs) command or method. See "Opening a Document" on page 28 and "Saving a Document" on page 31. Constants An additional important component of the Photoshop object model for JavaScript and VBScript are constants. Constants are a type of value that defines a property. For example, with the kind property of an Art Layer object, you can define only specific kinds that Photoshop allows. For general information about constants, see Introduction to Scripting. NOTE: Throughout this document, actual values of enumerations for VBScript are given using the following format: newLayerRef.Kind = 2 '2 indicates psLayerKind --> 2 (psTextLayer) The ' before the explanation creates a comment and prevents the text to the right of the ' from being read by the scripting engine. For more information about using comments, see Introduction to Scripting. For example, look up the art ArtLayer object in either the Adobe Photoshop CS4 JavaScript Scripting Reference or in the Adobe Photoshop CS4 Visual Basic Scripting Reference. One of the properties of this object is Kind( kind). The value type for that property contains a link to the constant that define the allowed values for the property. For VBScript, the constant is PSLayerKind, for JavaScript, the constant is LayerKind. Click the link to view the values you can use to define the kind property. NOTE: Different objects can use the same property name with different constant values. The constant values for the Channel object's kind property are different than the constant values for the Art Layer object's kind property.

  • 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
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87

C
HAPTER
2: Photoshop Scripting Basics
Photoshop Object Model
16
Additional objects
The Photoshop object model includes additional objects beyond the ones described in the containment
hierarchy above. Most of these classes are used as types for properties or to provide information (as
arguments) for commands or methods. For example:
The
color
value
(SolidColor/SolidColor)
class provides the type for the
background
color
(backgroundColor/backgroundColor)
and
foreground
color
(ForegroundColor/foregroundColor)
properties of the
Application
object. See
“Working with
color objects” on page 51
.
Open and save options for documents are defined as classes, and these are passed to the commands
that open and save documents; e.g., the
BMP
save
options
(
BMPSaveOptions/BMPSaveOptions)
class can be passed as an argument to the
save
(
saveAs
/
saveAs
) command or method. See
“Opening
a Document” on page 28
and
“Saving a Document” on page 31
.
Constants
An additional important component of the Photoshop object model for JavaScript and VBScript are
constants
. Constants are a type of value that defines a property. For example, with the
kind
property of an
Art
Layer
object, you can define only specific kinds that Photoshop allows. For general information about
constants, see
Introduction to Scripting
.
N
OTE
:
Throughout this document, actual values of enumerations for VBScript are given using the
following format:
newLayerRef.Kind = 2 '2 indicates psLayerKind --> 2 (psTextLayer)
The
'
before the explanation creates a
comment
and prevents the text to the right of the ' from being read
by the scripting engine. For more information about using comments, see
Introduction to Scripting
.
For example, look up the art
ArtLayer
object in either the
Adobe Photoshop CS4 JavaScript Scripting
Reference
or in the
Adobe Photoshop CS4 Visual Basic Scripting Reference
. One of the properties of this
object is
Kind(
kind
). The value type for that property contains a link to the constant that define the
allowed values for the property. For VBScript, the constant is
PSLayerKind
, for JavaScript, the constant is
LayerKind
. Click the link to view the values you can use to define the
kind
property.
N
OTE
:
Different objects can use the same property name with different constant values. The constant
values for the
Channel
object’s
kind
property are different than the constant values for the
Art
Layer
object’s
kind
property.