Creating And Running An Applescript - Adobe 65014912 Manual

Photoshop cs4 extended
Table of Contents

Advertisement

C
2: Photoshop Scripting Basics
HAPTER

Creating and running an AppleScript

You must open the Apple® Script Editor application in order to complete this procedure.
N
: The default location for the Script Editor is Applications > AppleScript > Script Editor.
OTE
To create and run your first Photoshop AppleScript:
1. Enter the following script in the Script Editor:
N
OTE
-- Sample script to create a new text item and
-- change its contents.
--target Photoshop CS4
tell application "Adobe Photoshop CS4"
-- Create a new document and art layer.
set docRef to make new document with properties ¬
set artLayerRef to make new art layer in docRef
-- Change the art layer to be a text layer.
set kind of artLayerRef to text layer
-- Get a reference to the text object and set its contents.
set contents of text object of artLayerRef to "Hello, World"
end tell
2. Click Run to run the script. Photoshop creates a new document, adds a new layer, changes the layer's
type to text and sets the text to "Hello, World"
N
OTE
debugging.
: The lines preceded by "--" are comments. Entering the comments is optional.
{width:4 as inches, height:2 as inches}
: If you encounter errors, refer to Introduction to Scripting, which has a section on AppleScript
Creating a sample Hello World script 18

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents