Adding And Manipulating Text In A Text Item Object - Adobe 23102480 - Photoshop CS3 - PC Programming Manual

Scripting guide
Table of Contents

Advertisement

Adobe Photoshop CS3 Scripting Guide
Determining a Layer's Kind
The following examples use an
AS
if (kind of layerRef is text layer) then
...
endif
VBS
If layerRef.Kind = 2 Then '2 indicates psTextLayer
...
End If
JS
if (newLayerRef.kind == LayerKind.TEXT)
{...}

Adding and Manipulating Text in a Text Item Object

The following examples add and right-justify text in a text layer.
AS
set layerRef to make new art layer in current document with properties¬
{kind:text layer}
set contents of text object of layerRef to "Hello, World!"
set justification of text object of layerRef to right
VBS
Set textLayerRef = docRef.ArtLayers.Add()
textLayerRef.Kind = 2
textLayerRef.Name = "my text"
Set textItemRef = docRef.ArtLayers("my text").TextItem
textItemRef.Contents = "Hello, World!"
textItemRef.Justification = 3
'3 = psRight (for the constant value psJustification)
JS
var textLayerRef = docRef.artLayers.add()
textLayerRef.name = "my text"
textLayerRef.kind = LayerKind.TEXT
var textItemRef = docRef.artLayers["my text"].textItem
textItemRef.contents = "Hello, World!"
textItemRef.justification = Justification.RIGHT
Note:
The
be set to either
if
(TextItem/TextItem) object has a
text-object
point text (psPointText/TextType.POINTTEXT
Photoshop CS3
statement to check whether an existing layer is a text layer.
Scripting Photoshop CS3
property, which can
kind (Kind/kind)
) or
paragraph text
40

Advertisement

Table of Contents
loading

This manual is also suitable for:

13102498 - photoshop cs3 - macPhotoshop cs3

Table of Contents