AppleScript Scripting Reference for Windows® and Macintosh®.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or
electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior written consent of Adobe Systems Incorporated. The software described in this document is furnished under
license and may only be used or copied in accordance with the terms of such license.
This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or
inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and
all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights.
Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual
organization.
Adobe, the Adobe logo, Acrobat, Illustrator, and Photoshop are either registered trademarks or trademarks of Adobe Systems Incorporated in
the United States and/or other countries.
Apple, Mac, and Macintosh are trademarks of Apple Computer, Inc., registered in the United States and other countries. Microsoft, and
Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. JavaScript and all
Java-related marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a
registered trademark of The Open Group.
All other trademarks are the property of their respective owners.
If this guide is distributed with software that includes an end user agreement, this guide, as well as the software described in it, is furnished
under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part
of this guide may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording,
or otherwise, without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected
under copyright law even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or
inaccuracies that may appear in the informational content contained in this guide.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
Changes Since Earlier Versions.................................................................................................................................................. 8
art layer, art layers ........................................................................................................................................................................15
BMP save options .........................................................................................................................................................................25
brightness and contrast.............................................................................................................................................................27
camera raw open options .........................................................................................................................................................28
color balance..................................................................................................................................................................................35
color value.......................................................................................................................................................................................36
dust and scratches .......................................................................................................................................................................51
EPS open options .........................................................................................................................................................................52
EPS save options...........................................................................................................................................................................53
export options save for web.....................................................................................................................................................56
gallery color options ...................................................................................................................................................................61
GIF save options............................................................................................................................................................................68
high pass..........................................................................................................................................................................................72
history state, history states .......................................................................................................................................................73
HSB color .........................................................................................................................................................................................74
JPEG save options ........................................................................................................................................................................81
Lab color ..........................................................................................................................................................................................82
maximum filter..............................................................................................................................................................................93
median noise..................................................................................................................................................................................94
no color ............................................................................................................................................................................................98
open options............................................................................................................................................................................... 103
path point, path points ........................................................................................................................................................... 106
path point info............................................................................................................................................................................ 107
PDF open options...................................................................................................................................................................... 108
PDF save options ....................................................................................................................................................................... 110
Photo CD open options........................................................................................................................................................... 113
Photoshop DCS 1.0 save options......................................................................................................................................... 114
Photoshop DCS 2.0 save options......................................................................................................................................... 116
Photoshop save options ......................................................................................................................................................... 118
PICT file save options ............................................................................................................................................................... 119
PICT resource save options.................................................................................................................................................... 120
Pixar save options ..................................................................................................................................................................... 124
PNG save options ...................................................................................................................................................................... 125
raw format open options........................................................................................................................................................ 131
raw save options........................................................................................................................................................................ 132
RGB color ...................................................................................................................................................................................... 133
save options ................................................................................................................................................................................ 136
sub path info............................................................................................................................................................................... 150
sub path item, sub path items.............................................................................................................................................. 151
Targa save options.................................................................................................................................................................... 152
texture fill ..................................................................................................................................................................................... 161
TIFF save options....................................................................................................................................................................... 163
close ............................................................................................................................................................................................... 176
convert to shape........................................................................................................................................................................ 179
create PDF presentation ......................................................................................................................................................... 182
create work path........................................................................................................................................................................ 183
do action....................................................................................................................................................................................... 188
do javascript................................................................................................................................................................................ 189
fill path .......................................................................................................................................................................................... 196
index .............................................................................................................................................................................................. 203
link .................................................................................................................................................................................................. 205
make clipping path................................................................................................................................................................... 207
make work path ......................................................................................................................................................................... 208
open ............................................................................................................................................................................................... 211
reset from comp ........................................................................................................................................................................ 218
select all ........................................................................................................................................................................................ 226
similar ............................................................................................................................................................................................ 227
trim ................................................................................................................................................................................................. 235
web safe color............................................................................................................................................................................. 237
Appendix A: Event ID Codes ................................................................................................... 238
Index .........................................................................................................................................246
1
Introduction
This reference describes the objects and commands in the Adobe® Photoshop® CS2 AppleScript
dictionary. A companion document, Photoshop CS2 Scripting Guide, describes basic scripting concepts
and the Photoshop object model. This document provides reference details of the Photoshop object
model, and additional information on AppleScript-specific features.
This book contains the following sections:
● This introduction, which describes scripting support in Adobe Photoshop CS2, and lists changes to the
AppleScript interface since the previous release.
● AppleScript Objects, which provides a complete reference for all Photoshop DOM objects and
commands.
● AppleScript Commands, which provides a complete reference for all AppleScript Photoshop DOM commands.
Changes Since Earlier Versions
The following changes have been made to the AppleScript object model and language support in Adobe
Photoshop CS2:
● Support for interapplication communication among Creative Suite 2 applications through exported
ExtendScript functions and interapplication messaging. For details, see the Creative Suite 2 Bridge
JavaScript Reference.
● The following classes have been added to the AppleScript interface:
● camera raw open options, which you use to specify options when opening a document in
camera raw format.
● export options save for web, which you use to optimize documents for the Web.
● contact sheet options, which you use to create and format contact sheets.
● batch options, which you use to specify options for the Batch command.
● lens blur options, which you use to specify options when applying the Lens Blur filter to a layer.
8
2
Action Manager
Adobe Photoshop CS2 actions allow you to save time by automating repetitive tasks.
Note: You create and run actions in the application interface using the Actions palette.
You can manage actions in scripts using a utility called the Action Manager. The Action Manager also allows
you to write scripts that target Adobe Photoshop CS2 functionality that is not otherwise accessible in the
scripting interface, such as third party plug-ins and filters that are available through the application but
not in the current scripting reference.
The only requirement for using the Action Manager is that the task that you want to access from the Action
Manager is recordable.
This chapter describes how to use the Action Manager and the scripting interface objects it includes.
Running JavaScript based Action Manager code from AppleScript
There is no Action Manager functionality in AppleScript. However, you can execute JavaScript code and
files from AppleScript using the
You need to rewrite your JavaScript code slightly to work with the do javascript command’s arguments
in order to get access to the AppleScript values from JavaScript. For example save the following JavaScript
Emboss.jsx:
as
do javascript command. See ‘do javascript’ on page 189.
function emboss(angle, height, amount)
{
var id32 = charIDToTypeID("Embs");
var desc7 = new ActionDescriptor();
var id33 = charIDToTypeID("Angl");
desc7.putInteger(id33, angle);
var id34 = charIDToTypeID("Hght");
desc7.putInteger(id34, height);
var id35 = charIDToTypeID("Amnt");
desc7.putInteger(id35, amount);
executeAction(id32, desc7);
}
In your AppleScript, call the Emboss function with values provided in the arguments collection, as follows:
emboss(arguments[0], arguments[1], arguments[2]);
The following AppleScript code sample runs the Emboss filter:
tell application "Adobe Photoshop CS2"
do javascript (file <path to Emboss.jsx>) ¬
with arguments { 75,2,89 }
end tell
Note: For information on creating JavaScripts to use with the Action Manager, see Action Manager chapter
in the Adobe Photoshop CS2 JavaScript Scripting Reference, which is available on the installation CD.
9
3
Elements
AppleScript Objects
The objects of the AppleScript dictionary for Adobe Photoshop CS2 are presented alphabetically and in
tabular format in this chapter. Where appropriate, the object class has two tables:
● Element — Lists the classes that inherit from the current class, as well as the methods by which the
classes can be referred.
● Property — The properties you can use with the object, as well as each property’s value type, input
status, and description.
The commands that can be used with an object are listed below the object’s Properties table.
Sample code for several object classes is given to help illustrate the syntax as well as usage of the object
class.
The following sample tables and command list illustrate the format for this chapter.
ElementRefer to by
channel
Properties
PropertyValue TypeWhat it is
bits per channel
component channels
current channels
current layer
info
Valid Commands
change mode
close
convert
count
name, numeric index, as a range of elements, before
after another element, satisfying a test
Valid values:
eight
one
sixteen
list of channels
list of channel
layer
info-object
The number of bits per channel.
Read-only. A list of the component color channels.
Options that may be supplied when applying an Add Noise filter.
add noise class supplies properties for the filter options class. The add noise class is used only
The
to define a record whose properties specify options when applying an Add Noise filter.
options can be supplied only in conjunction with the filter command. It is not possible to get or create
add noise object.
an
See the filter command for additional details.
Properties
PropertyValue TypeWhat it is
add noise
amount
distribution
monochromatic
real
Valid values:
Gaussian
uniform
boolean
(amount: 0.1% - 400%)
The following code sample demonstrates how to apply the add noise filter using the filter command of the
add noise class (inherited from the filter options super class).
...
filter current layer of the current document using add noise filter ¬
with options {class:add noise, distribution:uniform ¬
monochromatic:false}
Options used with the adjust method. The following classes inherit properties from the adjustment options
class: automatic contrast, automatic levels, brightness and contrast, color balance, curves,
Read-only. The application preference settings
(equivalent to selecting Edit > Preferences in the
Adobe Photoshop CS2 application in Windows or
Photoshop > Preferences in Mac OS).
version
Unicode text
Read-only. The Adobe Photoshop version.
The the first line of the following code sample directs Adobe Photoshop CS2 to carry out the script’s
commands. The second line uses the
activate command to make Adobe Photoshop CS2 the frontmost
Any layer that can contain data. The art layer class inherits properties from the layer, layers class.
Properties
PropertyValue TypeWhat it is
best type
class type
default type
index
properties
all locked
blend mode
type class
class
type class
integer
record
boolean
Valid Values:
color blend
color burn
color dodge
darken
difference
dissolve
exclusion
hard light
hue blend
lighten
linear burn
linear dodge
linear light
luminosity
multiply
normal
overlay
pass through
pin light
saturation blend
screen
soft light
vivid light
Read-only. (Inherited from the layer class)
The best type for the object's value.
Read-only. (Inherited from the layer class)
The object’s class.
Read-only. (Inherited from the layer class)
The default type for the object’s value.
Read-only. (Inherited from the layer class)
The index of this instance of the object.
Read-only. (Inherited from the layer class) All
of this object’s properties returned in a single
record.
Read-only. (Inherited from the layer class)
Indication of whether all of the layer’s
contents are locked or editable.
(Inherited from the layer class) The mode
used when compositing an object.
bounds
container
list
reference
Read-only. (Inherited from the layer class) A
list of coordinates that describes the bounding
rectangle of the layer.
Read-only. (Inherited from the layer class)
The object’s container.
The automatic contrast class supplies options properties for the adjustment options class to
automatically adjust the overall contrast and mixture of colors in an RGB image.
automatic contrast class, which is analogous to the Auto Contrast command in the Adobe
The
Photoshop CS2 application, is used only to define a record containing properties that specify options
when using the
contrast
create an
See the adjust command for additional details.
The following code sample demonstrates how to apply an Automatic Contrast adjustment using the
adjust command of the automatic contrast class (inherited from the adjustment options super
class).
...
adjust current layer of the current document using automatic contrast adjustment¬
with options {class:automatic contrast}
adjust command to apply an Auto Contrast adjustment to an image. The automatic
class can be used only in conjunction with the adjust command. It is not possible to get or
The automatic levels class supplies options properties for the adjustment options class to
automatically adjust the black point and white point in an image.
automatic levels class, which is analogous to the Auto Levels command in the Adobe Photoshop
The
CS2 application, is used only to define a record containing properties that specify options when using the
adjust command to apply an Auto Levels adjustment to an image. The automatic levels class can be
used only in conjunction with the
levels
object.
See the adjust command for additional details.
adjust command. It is not possible to get or create an automatic
The following code sample demonstrates how to apply an Automatic Levels adjustment using the
command of the
...
adjust current layer of the current document using automatic levels adjustment¬
with options {class:automatic levels}
automatic levels class (inherited from the adjustment options super class).
Options that can be specified when changing the document mode to Bitmap using the change mode
command. The
This class is used to define a record containing properties used to specify options when changing a
document’s mode.
command. It is not possible to get or create a
command for more details.
Properties
PropertiesValue TypeWhat it is
bitmap mode class inherits properties from the change mode optionsclass.
Bitmap mode options can only be supplied in conjunction with the change mode
Options that may be supplied when applying a Blur filter.
blur class supplies properties for the filter options class. The blur class is used only to define a
The
record when using the
conjunction with the
See the
filter command for additional details.
filter command to apply a Blur filter. blur options can be supplied only in
filter command. It is not possible to get or create a blur object.
The following code sample demonstrates how to apply the blur filter using the filter command of the
class (inherited from the filter options super class).
...
filter current layer of the current document using blur filter
with options {class:blur}
The blur more class supplies properties for the filter options class when using the filter command
apply a Blur More filter. The
command to apply a Blur More filter. The
filter command. It is not possible to get or create a blur more object.
See the
filter command for additional details.
The following code sample demonstrates how to apply the blur more filter using the filter command of the
blur more class (inherited from the filter options super class).
...
filter current layer of the current document using blur more filter
with options {class:blur more}
blur more class is used only to define a record when using the filter
blur more option can be supplied only in conjunction with the
The following code creates the myOptions variable to hold the BMP save options, then uses the save
command to save the document with the specified options. The code uses the default values for the
properties
tell application "Adobe Photoshop CS2"
bits per channel (twentyfour) and target operating system (true).
make new document
set myOptions to {class:BMP save options, ¬
save layers: true, save alpha channels: true¬
image compression: RLE compression:true, save annotations: true}
save current document in file myFile as BMP with options ¬
The brightness and contrast class supplies options properties for the adjustment options class to
adjust the tonal range of an image.
brightness and contrast class, which is analogous to the Brightness/Contrast command in the
The
Adobe Photoshop CS2 application, is used only to define a record containing properties that specify
options when applying a Brightness/Contrast adjustment to an image. The
class can be used only in conjunction with the adjust command. It is not possible to get or create a
brightness and contrast object.
See the adjust command for additional details.
Properties
PropertyValue TypeWhat it is
brightness and contrast
brightness level
contrast level
integer
integer
(-100 - 100)
(-100 - 100)
The following code sample demonstrates how to apply a Brightness/Contrast adjustment using the
adjust command of the brightness and contrast class (inherited from the adjustment options
super class).
...
adjust current layer of the current document using brightness and contrast
adjustment¬
Options that can be specified when opening a document in Camera Raw format. The camera raw open
options
This class is used to define a record containing properties that specify options when opening a document
in raw format.
is not possible to get or create a
Properties
PropertyValue typeWhat it is
class inherits properties from the open options class.
camera raw open options can be supplied only in conjunction with the open command. It
camera raw open options object.
bitsPerChannel
blueHue
blueSaturation
brightness
chromaticAberrationBY
chromaticAberrationRC
colorNoiseReduction
colorSpace
contrast
Valid values:
EIGHT
ONE
SIXTEEN
THIRTYTWO
integer
integer
integer
integer
integer
integer
Valid values:
ADOBERGB
COLORMATCHRGB
PROPHOTORGB
SRGB
integer
The number of bits per channel.
The blue hue of the shot (-100 - 100).
The blue saturation of the shot (-100 - 100).
The brightness of the shot (0 - 150).
The chromatic aberration B/Y of the shot (-100 -
100).
The chromatic aberration R/C of the shot (-100 -
100).
The color noise reduction of the shot (0 - 100).
The colorspace for the image.
The contrast of the shot (-50 - 100).
exposure
greenHue
greenSaturation
luminanceSmoothing
redHue
redSaturation
resolution
saturation
real
integer
integer
integer
integer
integer
real
integer
The exposure of the shot (4.0 - 4.0).
The green hue of the shot (-100 - 100).
The green saturation of the shot (-100 - 100).
The luminance smoothing of the shot (0 - 100).
The red hue of the shot (-100 - 100).
The red saturation of the shot (-100 - 100).
The resolution of the document in pixels per
inch (1 - 999).