Applying Color To A Text Item - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER

Applying color to a text item

In this section, we will add a layer to the
displays the text Hello, World! in red.
Before you begin, do the following:
Make sure Photoshop is closed.
Open the script file
AS
To create and specify details in a text item:
1. Type the following code into the
of the file that restore original preferences.
--create a variable named theDocRef
--assign the current (active) document to it
set theDocRef to the current document
--create a variable that contains a color object of the RGB color class
--whose color is red
set theTextColor to {class:RGB color, red:255, green:0, blue:0}
--create a variable for the text layer, create the layer as an art layer object
--and use the kind property of the art layer object to make it a text layer
set theTextLayer to make new art layer in theDocRef with ¬
properties {kind:text layer}
--Set the contents, size, position and color of the text layer
set contents of text object of theTextLayer to "Hello, World!"
set size of text object of theTextLayer to 36
set position of text object of theTextLayer to {0.75 as inches, 1 as inches}
set stroke color of text object of theTextLayer to theTextColor
2. Run the complete script. Be patient while Photoshop executes your commands one by one.
3. After viewing the document in Photoshop, close the document without saving it.
N
: Look up the following classes in the Adobe Photoshop CS5 AppleScript Scripting Reference or in the
OTE
Photoshop AppleScript Dictionary to see if you understand how you used them in this script:
RGB color
art layer
HelloWorldDoc
HelloWorldDoc
class
class
script, then change the layer to a text object that
HelloWorldDoc
in your script editor application.
script immediately before the statements at the end
Advanced Scripting 64

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents