Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting Photoshop CS2 54
Using the Text Item Object
You can change an existing
ArtLayer
object to a text layer, that is, a
Text Item
object, if the layer is
empty. Conversely you can change a
Text Item
object to an
ArtLayer
object. This “reverse” procedure
rasterizes the text in the layer object.
The
Text Item
object is a property of the
ArtLayer
object. However, to create a new text layer, you must
create a new
ArtLayer
object and then set the art layer's
kind/Kind/kind
property to
text layer
/psTextLayer/ LayerKind.TEXT
.
To set or manipulate text in a text layer, you use the
text object/TextItem/textItem/
object, which is
also a property of the
ArtLayer
object.
Creating a Text Item Object
The following examples create an
ArtLayer
object and then use the
kind
property to convert it to a text
layer.
AS
make new art layer in current document with properties ¬
{ kind: text layer }
VBS
set newLayerRef = docRef.ArtLayers.Add()
newLayerRef.Kind = 2
'2 indicates psTextLayer
JS
var newLayerRef = docRef.artLayers.add()
newLayerRef.kind = LayerKind.TEXT
See
‘Photoshop CS2’s Object Model’ on page 8
for information on the relationship between
ArtLayer
objects and
TextItem
objects.
Also, look up the following:
●
The
kind
and
TextItem
properties of the
ArtLayer
object in the
Adobe Photoshop CS2 Visual Basic
Scripting Reference
and the
Adobe Photoshop CS2 JavaScript Scripting Reference
.
●
The
kind
and
text object
properties of the
Class art layer
in the
Adobe Photoshop CS2
AppleScript Scripting Reference
.
Determining a Layer’s Kind
The following examples use an
if
statement to check whether an existing layer is a text layer.
AS
if (kind of layerRef is text layer) then
VBS
If layerRef.Kind = 2 Then
'2 indicates psTextLayer
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...