Adobe Smoke Alarm CS3 Manuale Utente

Pagina di 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. Se
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 
.
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)