Adobe 23102480 Scripting Guide - Page 14

Additional Objects, Constants, Image > Measurement Scale, > Custom, Object Name, Description

Page 14 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in your document. Count Item Represents a counted item in the document. Measurement Represents the measurement scale for your Scale document. To create this object without using a script: (Continued) Choose the Color Sampler Tool, and click in the document. Choose the Count Tool and click in the document. The Measurement Scale object cannot be created, but you can change its properties by using Image > Measurement Scale > Custom. Additional Objects The Photoshop CS3 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 50. ● 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 26 and 'Saving a Document' on page 29. Constants An additional important component of the Photoshop CS3 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 CS3 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 CS3 JavaScript Scripting Reference or in the Adobe Photoshop CS3 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

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Photoshop CS3 Scripting Basics
14
Additional Objects
The Photoshop CS3 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 50
.
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 26
and
‘Saving a Document’ on page 29
.
Constants
An additional important component of the Photoshop CS3 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 CS3 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 CS3 JavaScript Scripting
Reference
or in the
Adobe Photoshop CS3 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.
Color Sampler
Represents a color sampler in your document.
Choose the Color Sampler
Tool, and click in the
document.
Count Item
Represents a counted item in the document.
Choose the Count Tool and
click in the document.
Measurement
Scale
Represents the measurement scale for your
document.
The Measurement Scale object
cannot be created, but you can
change its properties by using
Image > Measurement Scale
> Custom
.
Object Name
Description
To create this object without
using a script:
(Continued)