Adding And Manipulating Text In A Text Item Object; Working With Selection Objects - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER

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
N
: The
OTE
to either
(psParagraphText/TextType.PARAGRAPHTEXT
is automatically set to
The
text-object
property is set to
To familiarize yourself with this objects, properties, and commands in the scripting references, do the
following:
In the Adobe Photoshop CS5 AppleScript Scripting Reference or in the Photoshop AppleScript Dictionary,
look up the
In the Adobe Photoshop CS5 Visual Basic Scripting Reference, or in the Visual Basic Object Browser look
up the
with a text layer, look up the
In the Adobe Photoshop CS5 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer, look
up the
textItem
text layer, look up the

Working with Selection objects

You use a
document or a layer within a document. For example, you can apply effects to a selection or copy the
current selection to the clipboard.
(
text-object
TextItem/TextItem
point text (psPointText/TextType.POINTTEXT
point text
properties
height
paragraph text
properties and methods.
text-object
property of the
TextItem
property of the
TextItem
object to allow your scripts to act only on a specific, selected section of your
Selection
) object has a
.) When a new
.
,
, and
width
leading
.
object. To find the properties and methods you can use
ArtLayer
object.
TextItem
object. To find the properties and methods you can use with a
ArtLayer
object.
Working with the Photoshop Object Model 42
property, which can be set
kind Kind/kind)
) or
paragraph text
is created, its
text-object
are valid only when the text item's
property
kind
kind

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents