Adobe photoshop cs 2.0 User Guide

Page of 91
Photoshop CS2
Adobe Photoshop CS2  Scripting Guide
 Scripting basics     22
Our Hello World scripts will do the following:
1. Open the Photoshop CS2 application.
2. Create a new Document object.
When we create the document, we will also create a variable named docRef and then assign a 
reference to the document as the value of docRef. The document will be 4 inches wide and 2 inches 
high.
3. Create an Art Layer object. 
In our script, we will create a variable named artLayerRef and then assign a reference to the Art 
Layer
 object as the value of artLayerRef.
4. Define artLayerRef as a text item.
5. Set the contents of the text item to "Hello World".
Note:
We will also include comments throughout the scripts. In fact, because this is our first script, we will 
use comments to excess. 
These steps mirror a specific path in the containment hierarchy, as illustrated below.
 
Creating and Running an AppleScript
You must open Apple’s Script Editor application in order to complete this procedure.
Note:
The default location for the Script Editor is Applications > AppleScript > Script Editor.
To create and run your first Photoshop CS2 AppleScript:
1. Enter the following script in the Script Editor:
Application
Document
Art Layer
Text Item