ADOBE PHOTOSHOP CC
JAVASCRIPT SCRIPTING REFERENCE
bbc
© 2019 Adobe. All rights reserved.
Adobe® Photoshop® CC JavaScript Scripting Reference for Windows
®
and Macintosh®.
NOTICE: All information contained herein is the property of Adobe Inc. 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 Inc. 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 Inc. Adobe Inc. 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.
®
, the Adobe logo, Acrobat®, GoLive®, InDesign®, Illustrator®, Photoshop® are either registered trademarks or trademarks of Adobe Inc.
Adobe
in the United States and/or other countries.
Apple®, Mac OS®, 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. JavaScriptTM 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 Inc. 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 Inc. Adobe Inc. assumes no responsibility or liability for any errors or inaccuracies that may appear in the
informational content contained in this guide.
Adobe Inc., 345 Park Avenue, San Jose, CA 95110-2704 USA, www.adobe.com
Contents
1 Introduction ...............................................................................................................................32
JavaScript support in Adobe Photoshop CC ......................................................................................................................32
Executing scripts ....................................................................................................................................................................33
Installing scripts ...............................................................................................................................................................33
Executing other scripts..................................................................................................................................................33
Startup scripts .........................................................................................................................................................................33
Object model usage and naming...........................................................................................................................................34
2 JavaScript Object Reference ..................................................................................................... 35
Object descriptions......................................................................................................................................................................35
Properties notation ...............................................................................................................................................................35
displayDialogs.................................................................................................................................................................35
Methods notation ..................................................................................................................................................................35
crop.....................................................................................................................................................................................36
ActionDescriptor ..........................................................................................................................................................................37
Properties..................................................................................................................................................................................37
count ..................................................................................................................................................................................37
typename .........................................................................................................................................................................37
Methods ....................................................................................................................................................................................37
clear ....................................................................................................................................................................................37
erase ...................................................................................................................................................................................37
fromStream......................................................................................................................................................................37
getBoolean.......................................................................................................................................................................37
getClass .............................................................................................................................................................................37
getData..............................................................................................................................................................................37
getDouble ........................................................................................................................................................................37
getEnumerationType ...................................................................................................................................................37
getEnumerationValue..................................................................................................................................................37
getInteger.........................................................................................................................................................................37
getKey................................................................................................................................................................................37
getLargeInteger .............................................................................................................................................................38
getList ................................................................................................................................................................................38
getObjectType................................................................................................................................................................38
getObjectValue...............................................................................................................................................................38
getPath..............................................................................................................................................................................38
getReference ...................................................................................................................................................................38
getString ...........................................................................................................................................................................38
getType .............................................................................................................................................................................38
getUnitDoubleType......................................................................................................................................................38
getUnitDoubleValue.....................................................................................................................................................38
hasKey................................................................................................................................................................................38
isEqual................................................................................................................................................................................38
putBoolean ......................................................................................................................................................................38
putClass.............................................................................................................................................................................38
putData .............................................................................................................................................................................38
putDouble ........................................................................................................................................................................38
3
Adobe Photoshop CC
JavaScript Scripting Reference 4
putEnumerated ..............................................................................................................................................................38
putInteger ........................................................................................................................................................................39
putLargeInteger.............................................................................................................................................................39
putList................................................................................................................................................................................39
putObject..........................................................................................................................................................................39
putPath..............................................................................................................................................................................39
putReference...................................................................................................................................................................39
putString...........................................................................................................................................................................39
putUnitDouble................................................................................................................................................................39
toStream ...........................................................................................................................................................................39
ActionList.........................................................................................................................................................................................40
Properties..................................................................................................................................................................................40
count ..................................................................................................................................................................................40
typename .........................................................................................................................................................................40
Methods ....................................................................................................................................................................................40
clear ....................................................................................................................................................................................40
getBoolean.......................................................................................................................................................................40
getClass .............................................................................................................................................................................40
getData..............................................................................................................................................................................40
getDouble ........................................................................................................................................................................40
getEnumerationType ...................................................................................................................................................40
getEnumerationValue..................................................................................................................................................40
getInteger.........................................................................................................................................................................40
getLargeInteger .............................................................................................................................................................41
getList ................................................................................................................................................................................41
getObjectType................................................................................................................................................................41
getObjectValue...............................................................................................................................................................41
getPath..............................................................................................................................................................................41
getReference ...................................................................................................................................................................41
getString ...........................................................................................................................................................................41
getType .............................................................................................................................................................................41
getUnitDoubleType......................................................................................................................................................41
getUnitDoubleValue.....................................................................................................................................................41
putBoolean ......................................................................................................................................................................41
putClass.............................................................................................................................................................................41
putData .............................................................................................................................................................................41
putDouble ........................................................................................................................................................................41
putEnumerated ..............................................................................................................................................................41
putInteger ........................................................................................................................................................................41
putLargeInteger.............................................................................................................................................................41
putList................................................................................................................................................................................41
putObject..........................................................................................................................................................................42
putPath..............................................................................................................................................................................42
putReference...................................................................................................................................................................42
putString...........................................................................................................................................................................42
putUnitDouble................................................................................................................................................................42
ActionReference ...........................................................................................................................................................................43
Properties..................................................................................................................................................................................43
typename .........................................................................................................................................................................43
Methods ....................................................................................................................................................................................43
getContainer ...................................................................................................................
................................................43
Adobe Photoshop CC
JavaScript Scripting Reference 5
getDesiredClass..............................................................................................................................................................43
getEnumeratedType.....................................................................................................................................................43
getEnumeratedValue ...................................................................................................................................................43
getForm.............................................................................................................................................................................43
getIdentifier.....................................................................................................................................................................43
getIndex............................................................................................................................................................................43
getName ...........................................................................................................................................................................43
getOffset ...........................................................................................................................................................................43
getProperty......................................................................................................................................................................43
putClass.............................................................................................................................................................................44
putEnumerated ..............................................................................................................................................................44
putIdentifier.....................................................................................................................................................................44
putIndex............................................................................................................................................................................44
putName...........................................................................................................................................................................44
putOffset...........................................................................................................................................................................44
putProperty......................................................................................................................................................................44
Application .....................................................................................................................................................................................45
Properties..................................................................................................................................................................................45
activeDocument.............................................................................................................................................................45
backgroundColor...........................................................................................................................................................45
build....................................................................................................................................................................................45
colorSettings ...................................................................................................................................................................45
currentTool ......................................................................................................................................................................45
displayDialogs.................................................................................................................................................................45
documents .......................................................................................................................................................................45
fonts....................................................................................................................................................................................45
foregroundColor............................................................................................................................................................45
freeMemory .....................................................................................................................................................................46
locale ..................................................................................................................................................................................46
macintoshFileTypes......................................................................................................................................................46
measurementLog ..........................................................................................................................................................46
name...................................................................................................................................................................................46
notifiers .............................................................................................................................................................................46
notifiersEnabled.............................................................................................................................................................46
path.....................................................................................................................................................................................46
playbackDisplayDialogs ..............................................................................................................................................46
playbackParameters .....................................................................................................................................................46
preferences ......................................................................................................................................................................46
preferencesFolder .........................................................................................................................................................46
recentFiles ........................................................................................................................................................................46
scriptingBuildDate ........................................................................................................................................................46
scriptingVersion .............................................................................................................................................................46
systemInformation........................................................................................................................................................46
typename .........................................................................................................................................................................46
version ...............................................................................................................................................................................47
windowsFileTypes.........................................................................................................................................................47
Methods ....................................................................................................................................................................................47
batch ..................................................................................................................................................................................47
beep....................................................................................................................................................................................47
bringToFront ...................................................................................................................................................................47
changeProgressText.............................................................................................................
........................................47
Adobe Photoshop CC
JavaScript Scripting Reference 6
charIDToTypeID..............................................................................................................................................................47
compareWithNumbers................................................................................................................................................47
doAction ...........................................................................................................................................................................48
doForcedProgress .........................................................................................................................................................48
doProgress .......................................................................................................................................................................48
doProgressSegmentTask ............................................................................................................................................48
doProgressSubTask.......................................................................................................................................................49
doProgressTask ..............................................................................................................................................................49
eraseCustomOptions....................................................................................................................................................49
executeAction.................................................................................................................................................................49
executeActionGet..........................................................................................................................................................49
featureEnabled ...............................................................................................................................................................49
getCustomOptions........................................................................................................................................................49
isQuicktimeAvailable....................................................................................................................................................49
load .....................................................................................................................................................................................49
makeContactSheet........................................................................................................................................................50
makePDFPresentation .................................................................................................................................................50
makePhotoGallery.........................................................................................................................................................50
makePhotomerge..........................................................................................................................................................50
makePicturePackage....................................................................................................................................................50
open ...................................................................................................................................................................................50
openDialog ......................................................................................................................................................................50
purge..................................................................................................................................................................................51
putCustomOptions .......................................................................................................................................................51
refresh................................................................................................................................................................................51
refreshFonts.....................................................................................................................................................................51
runMenuItem ..................................................................................................................................................................51
showColorPicker ............................................................................................................................................................51
stringIDToTypeID...........................................................................................................................................................51
togglePalettes.................................................................................................................................................................51
toolSupportsBrushes....................................................................................................................................................51
(tool) ...................................................................................................................................................................................51
toolSupportsBrushPresets..........................................................................................................................................51
(tool) ...................................................................................................................................................................................51
typeIDToCharID..............................................................................................................................................................51
typeIDToStringID...........................................................................................................................................................52
updateProgress ..............................................................................................................................................................52
ArtLayer............................................................................................................................................................................................55
Properties..................................................................................................................................................................................55
allLocked...........................................................................................................................................................................55
blendMode.......................................................................................................................................................................55
bounds...............................................................................................................................................................................55
boundsNoEffects ...........................................................................................................................................................55
fillOpacity..........................................................................................................................................................................55
filterMaskDensity...........................................................................................................................................................55
filterMaskFeather...........................................................................................................................................................55
grouped ............................................................................................................................................................................55
isBackgroundLayer........................................................................................................................................................55
kind .....................................................................................................................................................................................55
layerMaskDensity...........................................................................................................................................................56
layerMaskFeather ...............................................................................................................
...........................................56
Adobe Photoshop CC
JavaScript Scripting Reference 7
linkedLayers.....................................................................................................................................................................56
name...................................................................................................................................................................................56
opacity...............................................................................................................................................................................56
parent.................................................................................................................................................................................56
pixelsLocked....................................................................................................................................................................56
positionLocked...............................................................................................................................................................56
textItem.............................................................................................................................................................................56
transparentPixelsLocked.............................................................................................................................................56
typename .........................................................................................................................................................................56
vectorMaskDensity........................................................................................................................................................56
vectorMaskFeather .......................................................................................................................................................56
visible .................................................................................................................................................................................56
xmpMetadata..................................................................................................................................................................56
Methods ....................................................................................................................................................................................57
adjustBrightnessContrast ...........................................................................................................................................57
adjustColorBalance.......................................................................................................................................................57
adjustCurves....................................................................................................................................................................57
adjustLevels.....................................................................................................................................................................57
applyAddNoise...............................................................................................................................................................57
applyAverage..................................................................................................................................................................57
applyBlur...........................................................................................................................................................................57
applyBlurMore ................................................................................................................................................................57
applyClouds.....................................................................................................................................................................57
applyCustomFilter.........................................................................................................................................................57
applyDeInterlace............................................................................................................................................................58
applyDespeckle..............................................................................................................................................................58
applyDifferenceClouds................................................................................................................................................58
applyDiffuseGlow ..........................................................................................................................................................58
applyDisplace..................................................................................................................................................................58
applyDustAndScratches..............................................................................................................................................58
applyGaussianBlur.........................................................................................................................................................58
applyGlassEffect.............................................................................................................................................................58
applyHighPass ................................................................................................................................................................58
applyLensBlur .................................................................................................................................................................59
applyLensFlare................................................................................................................................................................59
applyMaximum ..............................................................................................................................................................59
applyMedianNoise ........................................................................................................................................................59
applyMinimum ...............................................................................................................................................................60
applyMotionBlur ............................................................................................................................................................60
applyNTSC........................................................................................................................................................................60
applyOceanRipple.........................................................................................................................................................60
applyOffset.......................................................................................................................................................................60
applyPinch .......................................................................................................................................................................60
applyPolarCoordinates................................................................................................................................................60
applyRadialBlur ..............................................................................................................................................................60
applyRipple......................................................................................................................................................................60
applySharpen..................................................................................................................................................................60
applySharpenEdges......................................................................................................................................................60
applySharpenMore .......................................................................................................................................................60
applyShear .......................................................................................................................................................................61
applySmartBlur...............................................................................................................................................................61
Adobe Photoshop CC
JavaScript Scripting Reference 8
applySpherize .................................................................................................................................................................61
applyStyle.........................................................................................................................................................................61
applyTextureFill..............................................................................................................................................................61
applyTwirl.........................................................................................................................................................................61
applyUnSharpMask.......................................................................................................................................................61
applyWave........................................................................................................................................................................61
applyZigZag.....................................................................................................................................................................61
autoContrast....................................................................................................................................................................61
autoLevels ........................................................................................................................................................................61
clear ....................................................................................................................................................................................62
copy ....................................................................................................................................................................................62
cut........................................................................................................................................................................................62
desaturate ........................................................................................................................................................................62
duplicate...........................................................................................................................................................................62
equalize.............................................................................................................................................................................62
invert ..................................................................................................................................................................................62
link.......................................................................................................................................................................................62
merge.................................................................................................................................................................................62
mixChannels....................................................................................................................................................................63
move...................................................................................................................................................................................63
photoFilter .......................................................................................................................................................................63
posterize ...........................................................................................................................................................................63
rasterize.............................................................................................................................................................................63
remove...............................................................................................................................................................................63
resize ..................................................................................................................................................................................64
rotate..................................................................................................................................................................................64
selectiveColor..................................................................................................................................................................64
shadowHighlight ...........................................................................................................................................................64
threshold...........................................................................................................................................................................64
translate ............................................................................................................................................................................64
unlink .................................................................................................................................................................................64
ArtLayers..........................................................................................................................................................................................67
Properties..................................................................................................................................................................................67
length.................................................................................................................................................................................67
parent.................................................................................................................................................................................67
typename .........................................................................................................................................................................67
Methods ....................................................................................................................................................................................67
add ......................................................................................................................................................................................67
getByName ......................................................................................................................................................................67
removeAll .........................................................................................................................................................................67
BatchOptions .................................................................................................................................................................................68
Properties..................................................................................................................................................................................68
destination .......................................................................................................................................................................68
destinationFolder ..........................................................................................................................................................68
errorFile.............................................................................................................................................................................68
fileNaming........................................................................................................................................................................68
macintoshCompatible .................................................................................................................................................68
overrideOpen..................................................................................................................................................................68
overrideSave....................................................................................................................................................................68
startingSerial ...................................................................................................................................................................68
suppressOpen...................................................................................................................
..............................................68
Adobe Photoshop CC
JavaScript Scripting Reference 9
suppressProfile ...............................................................................................................................................................69
typename .........................................................................................................................................................................69
unixCompatible..............................................................................................................................................................69
windowsCompatible ....................................................................................................................................................69
BitmapConversionOptions .......................................................................................................................................................70
Properties..................................................................................................................................................................................70
angle...................................................................................................................................................................................70
frequency..........................................................................................................................................................................70
method..............................................................................................................................................................................70
patternName...................................................................................................................................................................70
resolution..........................................................................................................................................................................70
shape..................................................................................................................................................................................70
typename .........................................................................................................................................................................70
BMPSaveOptions ..........................................................................................................................................................................71
Properties..................................................................................................................................................................................71
alphaChannels................................................................................................................................................................71
depth..................................................................................................................................................................................71
flipRowOrder...................................................................................................................................................................71
osType................................................................................................................................................................................71
rleCompression ..............................................................................................................................................................71
typename .........................................................................................................................................................................71
CameraRAWOpenOptions ........................................................................................................................................................72
Properties..................................................................................................................................................................................72
bitsPerChannel ...............................................................................................................................................................72
blueHue.............................................................................................................................................................................72
blueSaturation................................................................................................................................................................72
brightness.........................................................................................................................................................................72
chromaticAberrationBY...............................................................................................................................................72
chromaticAberrationRC...............................................................................................................................................72
colorNoiseReduction....................................................................................................................................................72
colorSpace........................................................................................................................................................................72
contrast .............................................................................................................................................................................72
exposure ...........................................................................................................................................................................72
greenHue..........................................................................................................................................................................72
greenSaturation .............................................................................................................................................................72
luminanceSmoothing ..................................................................................................................................................72
redHue...............................................................................................................................................................................72
redSaturation ..................................................................................................................................................................72
resolution..........................................................................................................................................................................72
saturation .........................................................................................................................................................................72
settings..............................................................................................................................................................................72
shadows ............................................................................................................................................................................72
shadowTint ......................................................................................................................................................................72
sharpness..........................................................................................................................................................................72
size ......................................................................................................................................................................................72
temperature.....................................................................................................................................................................72
tint.......................................................................................................................................................................................73
typename .........................................................................................................................................................................73
vignettingAmount ........................................................................................................................................................73
vignettingMidpoint ......................................................................................................................................................73
whiteBalance...................................................................................................................
................................................73
Adobe Photoshop CC
JavaScript Scripting Reference 10
Channel............................................................................................................................................................................................74
Properties..................................................................................................................................................................................74
color....................................................................................................................................................................................74
histogram .........................................................................................................................................................................74
kind .....................................................................................................................................................................................74
name...................................................................................................................................................................................74
opacity...............................................................................................................................................................................74
parent.................................................................................................................................................................................74
typename .........................................................................................................................................................................74
visible .................................................................................................................................................................................74
Methods ....................................................................................................................................................................................74
duplicate...........................................................................................................................................................................74
merge.................................................................................................................................................................................75
remove...............................................................................................................................................................................75
Channels..........................................................................................................................................................................................76
Properties..................................................................................................................................................................................76
length.................................................................................................................................................................................76
parent.................................................................................................................................................................................76
typename .........................................................................................................................................................................76
Methods ....................................................................................................................................................................................76
add ......................................................................................................................................................................................76
getByName ......................................................................................................................................................................76
removeAll .........................................................................................................................................................................76
CMYKColor......................................................................................................................................................................................81
Properties..................................................................................................................................................................................81
black ...................................................................................................................................................................................81
cyan.....................................................................................................................................................................................81
magenta............................................................................................................................................................................81
typename .........................................................................................................................................................................81
yellow.................................................................................................................................................................................81
ColorSampler .................................................................................................................................................................................82
Properties..................................................................................................................................................................................82
color....................................................................................................................................................................................82
position .............................................................................................................................................................................82
parent.................................................................................................................................................................................82
typename .........................................................................................................................................................................82
Methods ....................................................................................................................................................................................82
move...................................................................................................................................................................................82
remove...............................................................................................................................................................................82
ColorSamplers ...............................................................................................................................................................................83
Properties..................................................................................................................................................................................83
length.................................................................................................................................................................................83
parent.................................................................................................................................................................................83
typename .........................................................................................................................................................................83
Methods ....................................................................................................................................................................................83
add ......................................................................................................................................................................................83
removeAll .........................................................................................................................................................................83
ContactSheetOptions .................................................................................................................................................................84
Properties..................................................................................................................................................................................84
acrossFirst.........................................................................................................................................................................84
bestFit ........................................................................................................................
........................................................84
Adobe Photoshop CC
JavaScript Scripting Reference 11
caption...............................................................................................................................................................................84
columnCount ..................................................................................................................................................................84
flatten.................................................................................................................................................................................84
font......................................................................................................................................................................................84
fontSize..............................................................................................................................................................................84
height.................................................................................................................................................................................84
horizontal .........................................................................................................................................................................84
mode ..................................................................................................................................................................................84
resolution..........................................................................................................................................................................84
rowCount..........................................................................................................................................................................84
typename .........................................................................................................................................................................84
useAutoSpacing.............................................................................................................................................................84
vertical ...............................................................................................................................................................................84
width ..................................................................................................................................................................................84
CountItem.......................................................................................................................................................................................85
Properties..................................................................................................................................................................................85
position .............................................................................................................................................................................85
parent.................................................................................................................................................................................85
typename .........................................................................................................................................................................85
Methods ....................................................................................................................................................................................85
remove...............................................................................................................................................................................85
CountItems .....................................................................................................................................................................................86
Properties..................................................................................................................................................................................86
length.................................................................................................................................................................................86
parent.................................................................................................................................................................................86
typename .........................................................................................................................................................................86
Methods ....................................................................................................................................................................................86
add ......................................................................................................................................................................................86
getByName ......................................................................................................................................................................86
removeAll .........................................................................................................................................................................86
DCS1_SaveOptions......................................................................................................................................................................87
Properties..................................................................................................................................................................................87
dCS......................................................................................................................................................................................87
embedColorProfile........................................................................................................................................................87
encoding...........................................................................................................................................................................87
halftoneScreen ...............................................................................................................................................................87
interpolation....................................................................................................................................................................87
preview..............................................................................................................................................................................87
transferFunction.............................................................................................................................................................87
typename .........................................................................................................................................................................87
vectorData........................................................................................................................................................................87
DCS2_SaveOptions......................................................................................................................................................................88
Properties..................................................................................................................................................................................88
dCS......................................................................................................................................................................................88
embedColorProfile........................................................................................................................................................88
encoding...........................................................................................................................................................................88
halftoneScreen ...............................................................................................................................................................88
interpolation....................................................................................................................................................................88
multiFileDCS....................................................................................................................................................................88
preview..............................................................................................................................................................................88
spotColors .....................................................................................................................
...................................................88
Adobe Photoshop CC
JavaScript Scripting Reference 12
transferFunction.............................................................................................................................................................88
typename .........................................................................................................................................................................88
vectorData........................................................................................................................................................................88
DICOMOpenOptions...................................................................................................................................................................89
Properties..................................................................................................................................................................................89
anonymize........................................................................................................................................................................89
columns.............................................................................................................................................................................89
reverse ...............................................................................................................................................................................89
rows ....................................................................................................................................................................................89
showOverlays..................................................................................................................................................................89
typename .........................................................................................................................................................................89
windowLevel...................................................................................................................................................................89
windowWidth .................................................................................................................................................................89
Document .......................................................................................................................................................................................90
Properties..................................................................................................................................................................................90
activeChannels ...............................................................................................................................................................90
activeHistoryBrushSource ..........................................................................................................................................90
activeHistoryState .........................................................................................................................................................90
activeLayer .......................................................................................................................................................................90
artLayers............................................................................................................................................................................90
backgroundLayer...........................................................................................................................................................90
bitsPerChannel ...............................................................................................................................................................90
channels............................................................................................................................................................................90
colorProfileName...........................................................................................................................................................90
colorProfileType.............................................................................................................................................................90
colorSamplers .................................................................................................................................................................90
componentChannels....................................................................................................................................................90
countItems.......................................................................................................................................................................91
fullName............................................................................................................................................................................91
guides ................................................................................................................................................................................91
height.................................................................................................................................................................................91
histogram .........................................................................................................................................................................91
historyStates....................................................................................................................................................................91
info......................................................................................................................................................................................91
layerComps......................................................................................................................................................................91
layers ..................................................................................................................................................................................91
layerSets............................................................................................................................................................................91
managed...........................................................................................................................................................................91
measurementScale .......................................................................................................................................................91
mode ..................................................................................................................................................................................91
name...................................................................................................................................................................................91
parent.................................................................................................................................................................................91
path.....................................................................................................................................................................................91
pathItems .........................................................................................................................................................................91
pixelAspectRatio ............................................................................................................................................................91
printSettings....................................................................................................................................................................91
quickMaskMode.............................................................................................................................................................92
resolution..........................................................................................................................................................................92
saved ..................................................................................................................................................................................92
selection............................................................................................................................................................................92
typename .......................................................................................................................
..................................................92
Adobe Photoshop CC
JavaScript Scripting Reference 13
width ..................................................................................................................................................................................92
xmpMetadata..................................................................................................................................................................92
Methods ....................................................................................................................................................................................93
autoCount ........................................................................................................................................................................93
changeMode ...................................................................................................................................................................93
close....................................................................................................................................................................................93
convertProfile..................................................................................................................................................................93
crop.....................................................................................................................................................................................93
duplicate...........................................................................................................................................................................93
exportDocument ...........................................................................................................................................................94
flatten.................................................................................................................................................................................94
flipCanvas .........................................................................................................................................................................94
importAnnotations .......................................................................................................................................................94
mergeVisibleLayers.......................................................................................................................................................94
paste...................................................................................................................................................................................94
print ....................................................................................................................................................................................94
printOneCopy .................................................................................................................................................................94
rasterizeAllLayers...........................................................................................................................................................94
recordMeasurements...................................................................................................................................................94
resizeCanvas....................................................................................................................................................................94
resizeImage......................................................................................................................................................................95
revealAll.............................................................................................................................................................................95
rotateCanvas ...................................................................................................................................................................95
save.....................................................................................................................................................................................95
saveAs ................................................................................................................................................................................95
splitChannels...................................................................................................................................................................95
suspendHistory...............................................................................................................................................................95
trap......................................................................................................................................................................................95
trim......................................................................................................................................................................................96
DocumentPrintSettings .............................................................................................................................................................98
Properties..................................................................................................................................................................................98
backgroundColor...........................................................................................................................................................98
bleedWidth ......................................................................................................................................................................98
caption...............................................................................................................................................................................98
centerCropMarks ...........................................................................................................................................................98
colorBars ...........................................................................................................................................................................98
copies.................................................................................................................................................................................98
cornerCropMarks ...........................................................................................................................................................98
colorHandling .................................................................................................................................................................98
activePrinter ....................................................................................................................................................................98
flip........................................................................................................................................................................................98
hardProof..........................................................................................................................................................................98
interpolate........................................................................................................................................................................98
labels ..................................................................................................................................................................................98
mapBlack ..........................................................................................................................................................................98
negative ............................................................................................................................................................................98
renderIntent ....................................................................................................................................................................98
posX....................................................................................................................................................................................98
posY....................................................................................................................................................................................98
printBorder.......................................................................................................................................................................98
printerName ....................................................................................................................
................................................98
Adobe Photoshop CC
JavaScript Scripting Reference 14
printSpace ........................................................................................................................................................................98
registrationMarks...........................................................................................................................................................98
scale....................................................................................................................................................................................99
vectorData........................................................................................................................................................................99
Methods ................................................................................................................................................................................. 100
setPagePosition........................................................................................................................................................... 100
DocumentInfo ............................................................................................................................................................................ 101
Properties............................................................................................................................................................................... 101
author ............................................................................................................................................................................. 101
authorPosition ............................................................................................................................................................. 101
caption............................................................................................................................................................................ 101
captionWriter ............................................................................................................................................................... 101
category ......................................................................................................................................................................... 101
city.................................................................................................................................................................................... 101
copyrighted .................................................................................................................................................................. 101
copyrightNotice .......................................................................................................................................................... 101
country ........................................................................................................................................................................... 101
creationDate................................................................................................................................................................. 101
credit ............................................................................................................................................................................... 101
exif.................................................................................................................................................................................... 101
headline ......................................................................................................................................................................... 101
instructions ................................................................................................................................................................... 101
jobName ........................................................................................................................................................................ 101
keywords........................................................................................................................................................................ 101
ownerUrl ........................................................................................................................................................................ 101
parent.............................................................................................................................................................................. 102
provinceState............................................................................................................................................................... 102
source.............................................................................................................................................................................. 102
supplementalCategories.......................................................................................................................................... 102
title................................................................................................................................................................................... 102
transmissionReference ............................................................................................................................................. 102
typename ...................................................................................................................................................................... 102
urgency .......................................................................................................................................................................... 102
Documents .................................................................................................................................................................................. 104
Properties............................................................................................................................................................................... 104
length.............................................................................................................................................................................. 104
parent.............................................................................................................................................................................. 104
typename ...................................................................................................................................................................... 104
Methods ................................................................................................................................................................................. 104
add ................................................................................................................................................................................... 104
getByName ................................................................................................................................................................... 104
EPSOpenOptions ....................................................................................................................................................................... 105
Properties............................................................................................................................................................................... 105
antiAlias.......................................................................................................................................................................... 105
constrainProportions ................................................................................................................................................ 105
height.............................................................................................................................................................................. 105
mode ............................................................................................................................................................................... 105
resolution....................................................................................................................................................................... 105
typename ...................................................................................................................................................................... 105
width ............................................................................................................................................................................... 105
EPSSaveOptions.................................................................................................................
........................................................ 106
Adobe Photoshop CC
JavaScript Scripting Reference 15
Properties............................................................................................................................................................................... 106
embedColorProfile..................................................................................................................................................... 106
encoding........................................................................................................................................................................ 106
halftoneScreen ............................................................................................................................................................ 106
interpolation................................................................................................................................................................. 106
preview........................................................................................................................................................................... 106
psColorManagement ................................................................................................................................................ 106
transferFunction.......................................................................................................................................................... 106
transparentWhites...................................................................................................................................................... 106
typename ...................................................................................................................................................................... 106
vectorData..................................................................................................................................................................... 106
ExportOptionsIllustrator......................................................................................................................................................... 107
Properties............................................................................................................................................................................... 107
path.................................................................................................................................................................................. 107
pathName...................................................................................................................................................................... 107
typename ...................................................................................................................................................................... 107
ExportOptionsSaveForWeb ................................................................................................................................................... 108
Properties............................................................................................................................................................................... 108
blur................................................................................................................................................................................... 108
colorReduction ............................................................................................................................................................ 108
colors............................................................................................................................................................................... 108
dither............................................................................................................................................................................... 108
ditherAmount .............................................................................................................................................................. 108
format ............................................................................................................................................................................. 108
includeProfile ............................................................................................................................................................... 108
interlaced....................................................................................................................................................................... 108
lossy................................................................................................................................................................................. 108
matteColor .................................................................................................................................................................... 108
optimized ...................................................................................................................................................................... 108
PNG8................................................................................................................................................................................ 108
quality ............................................................................................................................................................................. 109
transparency................................................................................................................................................................. 109
transparencyAmount................................................................................................................................................ 109
transparencyDither.................................................................................................................................................... 109
typename ...................................................................................................................................................................... 109
webSnap ........................................................................................................................................................................ 109
File................................................................................................................................................................................................... 110
Folder............................................................................................................................................................................................. 110
GalleryBannerOptions ............................................................................................................................................................. 111
Properties............................................................................................................................................................................... 111
contactInfo.................................................................................................................................................................... 111
date.................................................................................................................................................................................. 111
font................................................................................................................................................................................... 111
fontSize........................................................................................................................................................................... 111
photographer............................................................................................................................................................... 111
siteName........................................................................................................................................................................ 111
typename ...................................................................................................................................................................... 111
GalleryCustomColorOptions................................................................................................................................................. 112
Properties............................................................................................................................................................................... 112
activeLinkColor............................................................................................................................................................ 112
backgroundColor........................................................................................................................................................ 112
Adobe Photoshop CC
JavaScript Scripting Reference 16
bannerColor.................................................................................................................................................................. 112
linkColor......................................................................................................................................................................... 112
textColor ........................................................................................................................................................................ 112
typename ...................................................................................................................................................................... 112
visitedLinkColor........................................................................................................................................................... 112
GalleryImagesOptions............................................................................................................................................................. 113
Properties............................................................................................................................................................................... 113
border ............................................................................................................................................................................. 113
caption............................................................................................................................................................................ 113
dimension...................................................................................................................................................................... 113
font................................................................................................................................................................................... 113
fontSize........................................................................................................................................................................... 113
imageQuality................................................................................................................................................................ 113
includeCopyright........................................................................................................................................................ 113
includeCredits.............................................................................................................................................................. 113
includeFilename.......................................................................................................................................................... 113
includeTitle ................................................................................................................................................................... 113
numericLinks................................................................................................................................................................ 113
resizeConstraint .......................................................................................................................................................... 114
resizeImages................................................................................................................................................................. 114
typename ...................................................................................................................................................................... 114
GalleryOptions............................................................................................................................................................................ 115
Properties............................................................................................................................................................................... 115
addSizeAttributes....................................................................................................................................................... 115
bannerOptions ............................................................................................................................................................ 115
customColorOptions................................................................................................................................................. 115
emailAddress................................................................................................................................................................ 115
imagesOptions ............................................................................................................................................................ 115
includeSubFolders ..................................................................................................................................................... 115
layoutStyle .................................................................................................................................................................... 115
preserveAllMetadata................................................................................................................................................. 115
securityOptions ........................................................................................................................................................... 115
thumbnailOptions...................................................................................................................................................... 115
typename ...................................................................................................................................................................... 115
useShortExtension ..................................................................................................................................................... 115
useUTF8Encoding ...................................................................................................................................................... 115
GallerySecurityOptions ........................................................................................................................................................... 116
Properties............................................................................................................................................................................... 116
content ........................................................................................................................................................................... 116
font................................................................................................................................................................................... 116
fontSize........................................................................................................................................................................... 116
opacity............................................................................................................................................................................ 116
text................................................................................................................................................................................... 116
textColor ........................................................................................................................................................................ 116
textPosition................................................................................................................................................................... 116
textRotate...................................................................................................................................................................... 116
typename ...................................................................................................................................................................... 116
GalleryThumbnailOptions...................................................................................................................................................... 117
Properties............................................................................................................................................................................... 117
border ............................................................................................................................................................................. 117
caption............................................................................................................................................................................ 117
Adobe Photoshop CC
JavaScript Scripting Reference 17
columnCount ............................................................................................................................................................... 117
dimension...................................................................................................................................................................... 117
font................................................................................................................................................................................... 117
fontSize........................................................................................................................................................................... 117
includeCopyright........................................................................................................................................................ 117
includeCredits.............................................................................................................................................................. 117
includeFilename.......................................................................................................................................................... 117
includeTitle ................................................................................................................................................................... 117
rowCount....................................................................................................................................................................... 117
size ................................................................................................................................................................................... 117
typename ...................................................................................................................................................................... 117
GIFSaveOptions.......................................................................................................................................................................... 118
Properties............................................................................................................................................................................... 118
colors............................................................................................................................................................................... 118
dither............................................................................................................................................................................... 118
ditherAmount .............................................................................................................................................................. 118
forced.............................................................................................................................................................................. 118
interlaced....................................................................................................................................................................... 118
matte............................................................................................................................................................................... 118
palette............................................................................................................................................................................. 118
preserveExactColors.................................................................................................................................................. 118
transparency................................................................................................................................................................. 118
typename ...................................................................................................................................................................... 118
GrayColor...................................................................................................................................................................................... 119
Properties............................................................................................................................................................................... 119
gray.................................................................................................................................................................................. 119
typename ...................................................................................................................................................................... 119
Guide.............................................................................................................................................................................................. 120
Properties............................................................................................................................................................................... 120
direction......................................................................................................................................................................... 120
coordinate..................................................................................................................................................................... 120
Guides............................................................................................................................................................................................ 121
Properties............................................................................................................................................................................... 121
length.............................................................................................................................................................................. 121
parent.............................................................................................................................................................................. 121
typename ...................................................................................................................................................................... 121
Methods ................................................................................................................................................................................. 121
add ................................................................................................................................................................................... 121
getByName ................................................................................................................................................................... 121
HistoryState................................................................................................................................................................................. 122
Properties............................................................................................................................................................................... 122
name................................................................................................................................................................................ 122
parent.............................................................................................................................................................................. 122
snapshot ........................................................................................................................................................................ 122
typename ...................................................................................................................................................................... 122
HistoryStates ............................................................................................................................................................................... 123
Properties............................................................................................................................................................................... 123
length.............................................................................................................................................................................. 123
parent.............................................................................................................................................................................. 123
typename ...................................................................................................................................................................... 123
Methods ........................................................................................................................
......................................................... 123
Adobe Photoshop CC
JavaScript Scripting Reference 18
getByName ................................................................................................................................................................... 123
HSBColor....................................................................................................................................................................................... 124
Properties............................................................................................................................................................................... 124
brightness...................................................................................................................................................................... 124
hue ................................................................................................................................................................................... 124
saturation ...................................................................................................................................................................... 124
typename ...................................................................................................................................................................... 124
IndexedConversionOptions .................................................................................................................................................. 125
Properties............................................................................................................................................................................... 125
colors............................................................................................................................................................................... 125
dither............................................................................................................................................................................... 125
ditherAmount .............................................................................................................................................................. 125
forced.............................................................................................................................................................................. 125
matte............................................................................................................................................................................... 125
palette............................................................................................................................................................................. 125
preserveExactColors.................................................................................................................................................. 125
transparency................................................................................................................................................................. 125
typename ...................................................................................................................................................................... 125
JPEGSaveOptions ...................................................................................................................................................................... 126
Properties............................................................................................................................................................................... 126
embedColorProfile..................................................................................................................................................... 126
formatOptions ............................................................................................................................................................. 126
matte............................................................................................................................................................................... 126
quality ............................................................................................................................................................................. 126
scans................................................................................................................................................................................ 126
typename ...................................................................................................................................................................... 126
LabColor ....................................................................................................................................................................................... 127
Properties............................................................................................................................................................................... 127
a......................................................................................................................................................................................... 127
b ........................................................................................................................................................................................ 127
l.......................................................................................................................................................................................... 127
typename ...................................................................................................................................................................... 127
LayerComp................................................................................................................................................................................... 128
Properties............................................................................................................................................................................... 128
appearance ................................................................................................................................................................... 128
comment ....................................................................................................................................................................... 128
name................................................................................................................................................................................ 128
parent.............................................................................................................................................................................. 128
position .......................................................................................................................................................................... 128
selected .......................................................................................................................................................................... 128
typename ...................................................................................................................................................................... 128
visibility .......................................................................................................................................................................... 128
Methods ................................................................................................................................................................................. 128
apply................................................................................................................................................................................ 128
recapture ....................................................................................................................................................................... 128
remove............................................................................................................................................................................ 128
resetfromComp ........................................................................................................................................................... 128
LayerComps................................................................................................................................................................................. 129
Properties............................................................................................................................................................................... 129
length.............................................................................................................................................................................. 129
parent.........................................................................................................................
..................................................... 129
Adobe Photoshop CC
JavaScript Scripting Reference 19
typename ...................................................................................................................................................................... 129
Methods ................................................................................................................................................................................. 129
add ................................................................................................................................................................................... 129
getByName ................................................................................................................................................................... 129
removeAll ...................................................................................................................................................................... 129
Layers............................................................................................................................................................................................. 130
Properties............................................................................................................................................................................... 130
length.............................................................................................................................................................................. 130
parent.............................................................................................................................................................................. 130
typename ...................................................................................................................................................................... 130
Methods ................................................................................................................................................................................. 130
getByName ................................................................................................................................................................... 130
removeAll ...................................................................................................................................................................... 130
LayerSet ........................................................................................................................................................................................ 131
Properties............................................................................................................................................................................... 131
allLocked........................................................................................................................................................................ 131
artLayers......................................................................................................................................................................... 131
blendMode.................................................................................................................................................................... 131
bounds............................................................................................................................................................................ 131
enabledChannels........................................................................................................................................................ 131
layers ............................................................................................................................................................................... 131
layerSets......................................................................................................................................................................... 131
linkedLayers.................................................................................................................................................................. 131
name................................................................................................................................................................................ 131
opacity............................................................................................................................................................................ 131
parent.............................................................................................................................................................................. 131
typename ...................................................................................................................................................................... 131
visible .............................................................................................................................................................................. 131
Methods ................................................................................................................................................................................. 132
duplicate........................................................................................................................................................................ 132
link.................................................................................................................................................................................... 132
merge.............................................................................................................................................................................. 132
move................................................................................................................................................................................ 132
remove............................................................................................................................................................................ 132
resize ............................................................................................................................................................................... 132
rotate............................................................................................................................................................................... 132
translate ......................................................................................................................................................................... 132
unlink .............................................................................................................................................................................. 132
LayerSets ...................................................................................................................................................................................... 133
Properties............................................................................................................................................................................... 133
length.............................................................................................................................................................................. 133
parent.............................................................................................................................................................................. 133
typename ...................................................................................................................................................................... 133
Methods ................................................................................................................................................................................. 133
add ................................................................................................................................................................................... 133
getByName ................................................................................................................................................................... 133
removeAll ...................................................................................................................................................................... 133
MeasurementLog ...................................................................................................................................................................... 135
Methods ................................................................................................................................................................................. 135
exportMeasurements................................................................................................................................................ 135
deleteMeasurements .............................................................................................................
................................... 135
Adobe Photoshop CC
JavaScript Scripting Reference 20
MeasurementScale ................................................................................................................................................................... 136
Properties............................................................................................................................................................................... 136
pixelLength................................................................................................................................................................... 136
logicalLength ............................................................................................................................................................... 136
logicalUnits ................................................................................................................................................................... 136
NoColor......................................................................................................................................................................................... 137
Properties............................................................................................................................................................................... 137
typename ...................................................................................................................................................................... 137
Notifier........................................................................................................................................................................................... 138
Properties............................................................................................................................................................................... 138
event................................................................................................................................................................................ 138
eventClass ..................................................................................................................................................................... 138
eventFile ........................................................................................................................................................................ 138
parent.............................................................................................................................................................................. 138
typename ...................................................................................................................................................................... 138
Methods ................................................................................................................................................................................. 138
remove............................................................................................................................................................................ 138
Notifiers......................................................................................................................................................................................... 139
Properties............................................................................................................................................................................... 139
length.............................................................................................................................................................................. 139
parent.............................................................................................................................................................................. 139
typename ...................................................................................................................................................................... 139
Methods ................................................................................................................................................................................. 139
add ................................................................................................................................................................................... 139
removeAll ...................................................................................................................................................................... 139
PathItem ....................................................................................................................................................................................... 140
Properties............................................................................................................................................................................... 140
kind .................................................................................................................................................................................. 140
name................................................................................................................................................................................ 140
parent.............................................................................................................................................................................. 140
subPathItems ............................................................................................................................................................... 140
typename ...................................................................................................................................................................... 140
Methods ................................................................................................................................................................................. 140
deselect .......................................................................................................................................................................... 140
duplicate........................................................................................................................................................................ 140
fillPath............................................................................................................................................................................. 140
makeClippingPath...................................................................................................................................................... 141
makeSelection ............................................................................................................................................................. 141
remove............................................................................................................................................................................ 141
select ............................................................................................................................................................................... 141
strokePath ..................................................................................................................................................................... 141
PathItems ..................................................................................................................................................................................... 144
Properties............................................................................................................................................................................... 144
length.............................................................................................................................................................................. 144
parent.............................................................................................................................................................................. 144
typename ...................................................................................................................................................................... 144
Methods ................................................................................................................................................................................. 144
add ................................................................................................................................................................................... 144
getByName ................................................................................................................................................................... 144
removeAll ...................................................................................................................................................................... 144
PathPoint......................................................................................................................
................................................................ 145
Adobe Photoshop CC
JavaScript Scripting Reference 21
Properties............................................................................................................................................................................... 145
anchor............................................................................................................................................................................. 145
kind .................................................................................................................................................................................. 145
leftDirection.................................................................................................................................................................. 145
parent.............................................................................................................................................................................. 145
rightDirection............................................................................................................................................................... 145
typename ...................................................................................................................................................................... 145
PathPointInfo.............................................................................................................................................................................. 146
Properties............................................................................................................................................................................... 146
anchor............................................................................................................................................................................. 146
kind .................................................................................................................................................................................. 146
leftDirection.................................................................................................................................................................. 146
rightDirection............................................................................................................................................................... 146
typename ...................................................................................................................................................................... 146
PathPoints.................................................................................................................................................................................... 148
Properties............................................................................................................................................................................... 148
length.............................................................................................................................................................................. 148
parent.............................................................................................................................................................................. 148
typename ...................................................................................................................................................................... 148
PDFOpenOptions ...................................................................................................................................................................... 149
Properties............................................................................................................................................................................... 149
antiAlias.......................................................................................................................................................................... 149
bitsPerChannel ............................................................................................................................................................ 149
constrainProportions ................................................................................................................................................ 149
cropPage........................................................................................................................................................................ 149
height.............................................................................................................................................................................. 149
mode ............................................................................................................................................................................... 149
name................................................................................................................................................................................ 149
object .............................................................................................................................................................................. 149
page................................................................................................................................................................................. 149
resolution....................................................................................................................................................................... 149
suppressWarnings...................................................................................................................................................... 149
typename ...................................................................................................................................................................... 149
use3DObjectNumber ................................................................................................................................................ 149
usePageNumber ......................................................................................................................................................... 149
width ............................................................................................................................................................................... 149
PDFSaveOptions........................................................................................................................................................................ 150
Properties............................................................................................................................................................................... 150
alphaChannels............................................................................................................................................................. 150
annotations................................................................................................................................................................... 150
colorConversion.......................................................................................................................................................... 150
convertToEightBit....................................................................................................................................................... 150
description .................................................................................................................................................................... 150
destinationProfile ....................................................................................................................................................... 150
downgradeColorProfile............................................................................................................................................ 150
downSample ................................................................................................................................................................ 150
downSampleSize ........................................................................................................................................................ 150
downSampleSizeLimit .............................................................................................................................................. 150
embedColorProfile..................................................................................................................................................... 150
embedFonts ................................................................................................................................................................. 150
embedThumbnail.................................................................................................................
...................................... 150
Adobe Photoshop CC
JavaScript Scripting Reference 22
encoding........................................................................................................................................................................ 150
interpolation................................................................................................................................................................. 150
jpegQuality ................................................................................................................................................................... 151
layers ............................................................................................................................................................................... 151
optimizeForWeb ......................................................................................................................................................... 151
outputCondition......................................................................................................................................................... 151
outputConditionID..................................................................................................................................................... 151
PDFCompatibility........................................................................................................................................................ 151
PDFStandard ................................................................................................................................................................ 151
preserveEditing ........................................................................................................................................................... 151
presetFile ....................................................................................................................................................................... 151
profileInclusionPolicy................................................................................................................................................ 151
registryName................................................................................................................................................................ 151
spotColors ..................................................................................................................................................................... 151
tileSize............................................................................................................................................................................. 151
transparency................................................................................................................................................................. 151
typename ...................................................................................................................................................................... 151
useOutlines................................................................................................................................................................... 151
vectorData..................................................................................................................................................................... 152
view.................................................................................................................................................................................. 152
PhotoCDOpenOptions ............................................................................................................................................................ 153
Properties............................................................................................................................................................................... 153
colorProfileName........................................................................................................................................................ 153
colorSpace..................................................................................................................................................................... 153
orientation..................................................................................................................................................................... 153
pixelSize ......................................................................................................................................................................... 153
resolution....................................................................................................................................................................... 153
typename ...................................................................................................................................................................... 153
PhotoshopSaveOptions.......................................................................................................................................................... 154
Properties............................................................................................................................................................................... 154
alphaChannels............................................................................................................................................................. 154
annotations................................................................................................................................................................... 154
embedColorProfile..................................................................................................................................................... 154
layers ............................................................................................................................................................................... 154
spotColors ..................................................................................................................................................................... 154
typename ...................................................................................................................................................................... 154
PICTFileSaveOptions ................................................................................................................................................................ 155
Properties............................................................................................................................................................................... 155
alphaChannels............................................................................................................................................................. 155
compression................................................................................................................................................................. 155
embedColorProfile..................................................................................................................................................... 155
resolution....................................................................................................................................................................... 155
typename ...................................................................................................................................................................... 155
PICTResourceSaveOptions..................................................................................................................................................... 156
Properties............................................................................................................................................................................... 156
alphaChannels............................................................................................................................................................. 156
compression................................................................................................................................................................. 156
embedColorProfile..................................................................................................................................................... 156
name................................................................................................................................................................................ 156
resolution....................................................................................................................................................................... 156
resourceID .....................................................................................................................
................................................ 156
Adobe Photoshop CC
JavaScript Scripting Reference 23
typename ...................................................................................................................................................................... 156
PicturePackageOptions........................................................................................................................................................... 157
Properties............................................................................................................................................................................... 157
content ........................................................................................................................................................................... 157
flatten.............................................................................................................................................................................. 157
font................................................................................................................................................................................... 157
fontSize........................................................................................................................................................................... 157
layout .............................................................................................................................................................................. 157
mode ............................................................................................................................................................................... 157
opacity............................................................................................................................................................................ 157
resolution....................................................................................................................................................................... 157
text................................................................................................................................................................................... 157
textColor ........................................................................................................................................................................ 157
textPosition................................................................................................................................................................... 157
textRotate...................................................................................................................................................................... 157
typename ...................................................................................................................................................................... 157
PixarSaveOptions ...................................................................................................................................................................... 158
Properties............................................................................................................................................................................... 158
alphaChannels............................................................................................................................................................. 158
typename ...................................................................................................................................................................... 158
PNGSaveOptions ....................................................................................................................................................................... 159
Properties............................................................................................................................................................................... 159
compression................................................................................................................................................................. 159
interlaced....................................................................................................................................................................... 159
typename ...................................................................................................................................................................... 159
Preferences .................................................................................................................................................................................. 160
Properties............................................................................................................................................................................... 160
additionalPluginFolder............................................................................................................................................. 160
appendExtension........................................................................................................................................................ 160
askBeforeSavingLayeredTIFF.................................................................................................................................. 160
autoUpdateOpenDocuments ................................................................................................................................ 160
beepWhenDone.......................................................................................................................................................... 160
colorChannelsInColor ............................................................................................................................................... 160
colorPicker..................................................................................................................................................................... 160
columnGutter............................................................................................................................................................... 160
columnWidth ............................................................................................................................................................... 160
createFirstSnapshot................................................................................................................................................... 160
dynamicColorSliders.................................................................................................................................................. 160
editLogItems ................................................................................................................................................................ 160
exportClipboard.......................................................................................................................................................... 161
fontPreviewSize........................................................................................................................................................... 161
fullSizePreview............................................................................................................................................................. 161
gamutWarningOpacity............................................................................................................................................. 161
gridSize........................................................................................................................................................................... 161
gridStyle......................................................................................................................................................................... 161
gridSubDivisions......................................................................................................................................................... 161
guideStyle...................................................................................................................................................................... 161
iconPreview .................................................................................................................................................................. 161
imageCacheLevels ..................................................................................................................................................... 161
imagePreviews ............................................................................................................................................................ 161
interpolation..................................................................................................................
............................................... 161
Adobe Photoshop CC
JavaScript Scripting Reference 24
keyboardZoomResizesWindows........................................................................................................................... 161
macOSThumbnail....................................................................................................................................................... 161
maximizeCompatibility ............................................................................................................................................ 161
maxRAMuse.................................................................................................................................................................. 161
nonLinearHistory ........................................................................................................................................................ 161
numberofHistoryStates ............................................................................................................................................ 162
otherCursors................................................................................................................................................................. 162
paintingCursors........................................................................................................................................................... 162
parent.............................................................................................................................................................................. 162
pixelDoubling .............................................................................................................................................................. 162
pointSize ........................................................................................................................................................................ 162
recentFileListLength.................................................................................................................................................. 162
rulerUnits ....................................................................................................................................................................... 162
saveLogItems ............................................................................................................................................................... 162
saveLogItemsFile ........................................................................................................................................................ 162
savePaletteLocations ................................................................................................................................................ 162
showAsianTextOptions ............................................................................................................................................ 162
showEnglishFontNames .......................................................................................................................................... 162
showSliceNumber ...................................................................................................................................................... 162
showToolTips ............................................................................................................................................................... 162
smartQuotes................................................................................................................................................................. 162
textFontSize.................................................................................................................................................................. 162
typename ...................................................................................................................................................................... 162
typeUnits ....................................................................................................................................................................... 163
useAdditionalPluginFolder ..................................................................................................................................... 163
useHistoryLog.............................................................................................................................................................. 163
useLowerCaseExtension .......................................................................................................................................... 163
useShiftKeyForToolSwitch....................................................................................................................................... 163
useVideoAlpha ............................................................................................................................................................ 163
windowsThumbnail................................................................................................................................................... 163
PresentationOptions................................................................................................................................................................ 164
Properties............................................................................................................................................................................... 164
autoAdvance ............................................................................................................................................................... 164
includeFilename.......................................................................................................................................................... 164
interval............................................................................................................................................................................ 164
loop.................................................................................................................................................................................. 164
magnification............................................................................................................................................................... 164
PDFFileOptions............................................................................................................................................................ 164
presentation ................................................................................................................................................................ 164
transition........................................................................................................................................................................ 164
typename ...................................................................................................................................................................... 164
RawFormatOpenOptions ....................................................................................................................................................... 165
Properties............................................................................................................................................................................... 165
bitsPerChannel ............................................................................................................................................................ 165
byteOrder ...................................................................................................................................................................... 165
channelNumber .......................................................................................................................................................... 165
headerSize..................................................................................................................................................................... 165
height.............................................................................................................................................................................. 165
interleaveChannels .................................................................................................................................................... 165
retainHeader................................................................................................................................................................. 165
typename .......................................................................................................................
............................................... 165
Adobe Photoshop CC
JavaScript Scripting Reference 25
width ............................................................................................................................................................................... 165
RawSaveOptions........................................................................................................................................................................ 166
Properties............................................................................................................................................................................... 166
alphaChannels............................................................................................................................................................. 166
spotColors ..................................................................................................................................................................... 166
typename ...................................................................................................................................................................... 166
RGBColor....................................................................................................................................................................................... 167
Properties............................................................................................................................................................................... 167
blue.................................................................................................................................................................................. 167
green ............................................................................................................................................................................... 167
hexValue ........................................................................................................................................................................ 167
red .................................................................................................................................................................................... 167
typename ...................................................................................................................................................................... 167
Selection ....................................................................................................................................................................................... 168
Properties............................................................................................................................................................................... 168
bounds............................................................................................................................................................................ 168
parent.............................................................................................................................................................................. 168
solid ................................................................................................................................................................................. 168
typename ...................................................................................................................................................................... 168
Methods ................................................................................................................................................................................. 168
clear ................................................................................................................................................................................. 168
contract .......................................................................................................................................................................... 168
copy ................................................................................................................................................................................. 168
cut..................................................................................................................................................................................... 168
deselect .......................................................................................................................................................................... 168
expand............................................................................................................................................................................ 168
feather............................................................................................................................................................................. 168
fill ...................................................................................................................................................................................... 169
grow ................................................................................................................................................................................ 169
invert ............................................................................................................................................................................... 169
load .................................................................................................................................................................................. 169
makeWorkPath ............................................................................................................................................................ 169
resize ............................................................................................................................................................................... 169
resizeBoundary............................................................................................................................................................ 169
rotate............................................................................................................................................................................... 169
rotateBoundary ........................................................................................................................................................... 169
select ............................................................................................................................................................................... 169
selectAll.......................................................................................................................................................................... 169
selectBorder.................................................................................................................................................................. 170
similar.............................................................................................................................................................................. 170
smooth ........................................................................................................................................................................... 170
store................................................................................................................................................................................. 170
stroke............................................................................................................................................................................... 170
translate ......................................................................................................................................................................... 170
translateBoundary...................................................................................................................................................... 170
SGIRGBSaveOptions ................................................................................................................................................................. 173
Properties............................................................................................................................................................................... 173
alphaChannels............................................................................................................................................................. 173
spotColors ..................................................................................................................................................................... 173
typename ...................................................................................................................................................................... 173
SolidColor.....................................................................................................................
................................................................ 174
Adobe Photoshop CC
JavaScript Scripting Reference 26
Properties............................................................................................................................................................................... 174
cmyk ................................................................................................................................................................................ 174
gray.................................................................................................................................................................................. 174
hsb.................................................................................................................................................................................... 174
lab..................................................................................................................................................................................... 174
model.............................................................................................................................................................................. 174
nearestWebColor........................................................................................................................................................ 174
rgb.................................................................................................................................................................................... 174
typename ...................................................................................................................................................................... 174
Methods ................................................................................................................................................................................. 174
isEqual............................................................................................................................................................................. 174
SubPathInfo................................................................................................................................................................................. 175
Properties............................................................................................................................................................................... 175
closed.............................................................................................................................................................................. 175
entireSubPath .............................................................................................................................................................. 175
operation ....................................................................................................................................................................... 175
typename ...................................................................................................................................................................... 175
SubPathItem................................................................................................................................................................................ 176
Properties............................................................................................................................................................................... 176
closed.............................................................................................................................................................................. 176
operation ....................................................................................................................................................................... 176
parent.............................................................................................................................................................................. 176
pathPoints..................................................................................................................................................................... 176
typename ...................................................................................................................................................................... 176
SubPathItems.............................................................................................................................................................................. 177
Properties............................................................................................................................................................................... 177
length.............................................................................................................................................................................. 177
parent.............................................................................................................................................................................. 177
typename ...................................................................................................................................................................... 177
TargaSaveOptions..................................................................................................................................................................... 178
Properties............................................................................................................................................................................... 178
alphaChannels............................................................................................................................................................. 178
resolution....................................................................................................................................................................... 178
rleCompression ........................................................................................................................................................... 178
typename ...................................................................................................................................................................... 178
TextFont........................................................................................................................................................................................ 179
Properties............................................................................................................................................................................... 179
family............................................................................................................................................................................... 179
name................................................................................................................................................................................ 179
parent.............................................................................................................................................................................. 179
postScriptName ......................................................................................................................................................... 179
style.................................................................................................................................................................................. 179
typename ...................................................................................................................................................................... 179
TextFonts...................................................................................................................................................................................... 180
Properties............................................................................................................................................................................... 180
length.............................................................................................................................................................................. 180
parent.............................................................................................................................................................................. 180
typename ...................................................................................................................................................................... 180
Methods ................................................................................................................................................................................. 180
getByName ................................................................................................................................................................... 180
TextItem........................................................................................................................................................................................ 181
Adobe Photoshop CC
JavaScript Scripting Reference 27
Properties............................................................................................................................................................................... 181
alternateLigatures ...................................................................................................................................................... 181
antiAliasMethod.......................................................................................................................................................... 181
autoKerning.................................................................................................................................................................. 181
autoLeadingAmount................................................................................................................................................. 181
baselineShift................................................................................................................................................................. 181
capitalization................................................................................................................................................................ 181
color................................................................................................................................................................................. 181
contents ......................................................................................................................................................................... 181
desiredGlyphScaling.................................................................................................................................................. 181
desiredLetterScaling.................................................................................................................................................. 182
desiredWordScaling .................................................................................................................................................. 182
direction......................................................................................................................................................................... 182
fauxBold ......................................................................................................................................................................... 182
fauxItalic......................................................................................................................................................................... 182
firstLineIndent.............................................................................................................................................................. 182
font................................................................................................................................................................................... 182
hangingPunctuation ................................................................................................................................................. 182
height.............................................................................................................................................................................. 182
horizontalScale............................................................................................................................................................ 182
hyphenateAfterFirst................................................................................................................................................... 183
hyphenateBeforeLast................................................................................................................................................ 183
hyphenateCapitalWords.......................................................................................................................................... 183
hyphenateWordsLongerThan................................................................................................................................ 183
hyphenation................................................................................................................................................................. 183
hyphenationZone....................................................................................................................................................... 183
hyphenLimit ................................................................................................................................................................. 183
justification ................................................................................................................................................................... 183
kind .................................................................................................................................................................................. 183
language........................................................................................................................................................................ 183
leading............................................................................................................................................................................ 183
leftIndent ....................................................................................................................................................................... 183
ligatures ......................................................................................................................................................................... 183
maximumGlyphScaling............................................................................................................................................ 183
maximumLetterScaling............................................................................................................................................ 184
maximumWordScaling............................................................................................................................................. 184
minimumGlyphScaling............................................................................................................................................. 184
minimumLetterScaling............................................................................................................................................. 185
minimumWordScaling.............................................................................................................................................. 185
noBreak .......................................................................................................................................................................... 185
oldStyle........................................................................................................................................................................... 185
parent.............................................................................................................................................................................. 185
position .......................................................................................................................................................................... 185
rightIndent.................................................................................................................................................................... 185
size ................................................................................................................................................................................... 185
spaceAfter ..................................................................................................................................................................... 185
spaceBefore .................................................................................................................................................................. 186
strikeThru....................................................................................................................................................................... 186
textComposer .............................................................................................................................................................. 186
tracking........................................................................................................................................................................... 186
typename ...................................................................................................................................................................... 186
Adobe Photoshop CC
JavaScript Scripting Reference 28
underline........................................................................................................................................................................ 186
useAutoLeading.......................................................................................................................................................... 186
verticalScale.................................................................................................................................................................. 186
warpBend ...................................................................................................................................................................... 186
warpDirection .............................................................................................................................................................. 186
warpHorizontalDistortion........................................................................................................................................ 186
warpStyle....................................................................................................................................................................... 186
warpVerticalDistortion.............................................................................................................................................. 186
width ............................................................................................................................................................................... 186
Methods ................................................................................................................................................................................. 187
convertToShape.......................................................................................................................................................... 187
createPath ..................................................................................................................................................................... 187
TiffSaveOptions.......................................................................................................................................................................... 188
Properties............................................................................................................................................................................... 188
alphaChannels............................................................................................................................................................. 188
annotations................................................................................................................................................................... 188
byteOrder ...................................................................................................................................................................... 188
embedColorProfile..................................................................................................................................................... 188
imageCompression.................................................................................................................................................... 188
interleaveChannels .................................................................................................................................................... 188
jpegQuality ................................................................................................................................................................... 188
layerCompression....................................................................................................................................................... 188
layers ............................................................................................................................................................................... 188
saveImagePyramid..................................................................................................................................................... 188
spotColors ..................................................................................................................................................................... 188
transparency................................................................................................................................................................. 188
typename ...................................................................................................................................................................... 188
UnitValue...................................................................................................................................................................................... 189
xmpMetadata ............................................................................................................................................................................. 190
Properties............................................................................................................................................................................... 190
parent.............................................................................................................................................................................. 190
rawData.......................................................................................................................................................................... 190
typename ...................................................................................................................................................................... 190
3 JavaScript Resource................................................................................................................. 191
JavaScript resource syntax..................................................................................................................................................... 191
Basic JavaScript resource example............................................................................................................................... 192
Enable-info grammar............................................................................................................................................................... 192
Undefined values in enable-info evaluation............................................................................................................. 195
Using the "in" function...................................................................................................................................................... 195
Action Manager automation................................................................................................................................................. 195
Terminology dictionary .................................................................................................................................................... 195
Value type defintions .................................................................................................................................................. 196
Uniqueness rules for terminology entries.................................................................................................................. 197
Terminology definition example................................................................................................................................... 197
4 Scripting Constants .................................................................................................................199
AdjustmentReference............................................................................................................................................... 199
AnchorPosition............................................................................................................................................................ 199
AntiAlias ......................................................................................................................................................................... 199
AutoKernType.............................................................................................................................................................. 199
BatchDestinationType .............................................................................................................................................. 199
Adobe Photoshop CC
JavaScript Scripting Reference 29
BitmapConversionType............................................................................................................................................ 200
BitmapHalfToneType ................................................................................................................................................ 200
BitsPerChannelType................................................................................................................................................... 200
BlendMode.................................................................................................................................................................... 200
BMPDepthType ........................................................................................................................................................... 200
ByteOrder ...................................................................................................................................................................... 201
CameraRAWSettingsType........................................................................................................................................ 201
CameraRAWSize.......................................................................................................................................................... 201
ChangeMode................................................................................................................................................................ 201
ChannelType ................................................................................................................................................................ 201
ColorBlendMode......................................................................................................................................................... 202
ColorModel ................................................................................................................................................................... 202
ColorPicker.................................................................................................................................................................... 202
ColorProfileType ......................................................................................................................................................... 202
ColorReductionType.................................................................................................................................................. 202
ColorSpaceType .......................................................................................................................................................... 202
CopyrightedType........................................................................................................................................................ 202
CreateFields .................................................................................................................................................................. 203
CropToType .................................................................................................................................................................. 203
DCSType......................................................................................................................................................................... 203
DepthMapSource ....................................................................................................................................................... 203
DescValueType ............................................................................................................................................................ 203
DialogModes ................................................................................................................................................................ 203
Direction ........................................................................................................................................................................ 203
DisplacementMapType ............................................................................................................................................ 204
Dither .............................................................................................................................................................................. 204
DocPositionStyle......................................................................................................................................................... 204
DocumentFill................................................................................................................................................................ 204
DocumentMode.......................................................................................................................................................... 204
EditLogItemsType....................................................................................................................................................... 204
ElementPlacement..................................................................................................................................................... 204
EliminateFields ............................................................................................................................................................ 204
ExportType.................................................................................................................................................................... 204
Extension ....................................................................................................................................................................... 204
FileNamingType.......................................................................................................................................................... 205
FontPreviewType........................................................................................................................................................ 205
FontSize.......................................................................................................................................................................... 205
ForcedColors ................................................................................................................................................................ 205
FormatOptions ............................................................................................................................................................ 205
GalleryConstrainType................................................................................................................................................ 205
GalleryFontType.......................................................................................................................................................... 206
GallerySecurityTextColorType ............................................................................................................................... 206
GallerySecurityTextPositionType.......................................................................................................................... 206
GallerySecurityTextRotateType............................................................................................................................. 206
GallerySecurityType................................................................................................................................................... 206
GalleryThumbSizeType............................................................................................................................................. 206
Geometry....................................................................................................................................................................... 206
GridLineStyle................................................................................................................................................................ 206
GridSize .......................................................................................................................................................................... 206
GuideLineStyle............................................................................................................................................................. 207
IllustratorPathType............................................................................................................
......................................... 207
Adobe Photoshop CC
JavaScript Scripting Reference 30
Intent............................................................................................................................................................................... 207
Justification................................................................................................................................................................... 207
Language....................................................................................................................................................................... 207
LayerCompression...................................................................................................................................................... 207
LayerKind....................................................................................................................................................................... 208
LensType........................................................................................................................................................................ 208
MagnificationType ..................................................................................................................................................... 208
MatteType ..................................................................................................................................................................... 208
MeasurementRange .................................................................................................................................................. 208
MeasurementSource ................................................................................................................................................. 208
NewDocumentMode................................................................................................................................................. 208
NoiseDistribution........................................................................................................................................................ 209
OffsetUndefinedAreas .............................................................................................................................................. 209
OpenDocumentMode............................................................................................................................................... 209
OpenDocumentType................................................................................................................................................. 209
OperatingSystem........................................................................................................................................................ 209
Orientation.................................................................................................................................................................... 209
OtherPaintingCursors ............................................................................................................................................... 210
PaintingCursors........................................................................................................................................................... 210
PaletteType................................................................................................................................................................... 210
PathKind......................................................................................................................................................................... 210
PDFCompatibility........................................................................................................................................................ 210
PDFEncoding................................................................................................................................................................ 210
PDFResample ............................................................................................................................................................... 211
PDFStandard ................................................................................................................................................................ 211
PhotoCDColorSpace.................................................................................................................................................. 211
PhotoCDSize................................................................................................................................................................. 211
PICTBitsPerPixels......................................................................................................................................................... 211
PICTCompression........................................................................................................................................................ 211
PicturePackageTextType.......................................................................................................................................... 211
PointKind ....................................................................................................................................................................... 212
PointType ...................................................................................................................................................................... 212
PolarConversionType................................................................................................................................................ 212
Preview........................................................................................................................................................................... 212
PrintColorHandling.................................................................................................................................................... 212
PurgeTarget.................................................................................................................................................................. 212
QueryStateType........................................................................................................................................................... 212
RadialBlurMethod....................................................................................................................................................... 212
RadialBlurQuality ........................................................................................................................................................ 212
RasterizeType............................................................................................................................................................... 212
ReferenceFormType .................................................................................................................................................. 212
ResampleMethod ....................................................................................................................................................... 213
RippleSize ...................................................................................................................................................................... 213
SaveBehavior................................................................................................................................................................ 213
SaveDocumentType .................................................................................................................................................. 213
SaveEncoding .............................................................................................................................................................. 213
SaveLogItemsType..................................................................................................................................................... 213
SaveOptions ................................................................................................................................................................. 213
SelectionType............................................................................................................................................................... 214
ShapeOperation.......................................................................................................................................................... 214
SmartBlurMode ..................................................................................................................
......................................... 214
Adobe Photoshop CC
JavaScript Scripting Reference 31
SmartBlurQuality......................................................................................................................................................... 214
SourceSpaceType ....................................................................................................................................................... 214
SpherizeMode.............................................................................................................................................................. 214
StrikeThruType ............................................................................................................................................................ 214
StrokeLocation............................................................................................................................................................. 214
TargaBitsPerPixels ...................................................................................................................................................... 214
TextCase......................................................................................................................................................................... 215
TextComposer.............................................................................................................................................................. 215
TextType ........................................................................................................................................................................ 215
TextureType.................................................................................................................................................................. 215
TIFFEncoding................................................................................................................................................................ 215
ToolType ........................................................................................................................................................................ 215
TransitionType............................................................................................................................................................. 215
TrimType........................................................................................................................................................................ 216
TypeUnits....................................................................................................................................................................... 216
UndefinedAreas .......................................................................................................................................................... 216
UnderlineType ............................................................................................................................................................. 216
Units................................................................................................................................................................................. 216
Urgency.......................................................................................................................................................................... 216
WarpStyle ...................................................................................................................................................................... 216
WaveType...................................................................................................................................................................... 217
WhiteBalanceType...................................................................................................................................................... 217
ZigZagType................................................................................................................................................................... 217
Appendix A: Event ID Codes ................................................................................................... 218
Index .........................................................................................................................................226
1
Introduction
This reference describes the objects and methods in the Adobe® Photoshop® CC® JavaScriptTM type library.
A companion document, Photoshop CC 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 JavaScript-specific features.
Adobe Photoshop CC uses ExtendScript, Adobe’s extended implementation of JavaScript. See JavaScript
support in Adobe Photoshop CC for additional information.
This book contains the following sections:
● This introduction, which describes scripting support in Adobe Photoshop CC, and lists changes to the
JavaScript interface since the previous release.
● JavaScript Object Reference, which provides a complete reference for all Photoshop DOM objects and
commands.
● Scripting Constants, which lists all enumerations used in the Photoshop type library.
JavaScript support in Adobe Photoshop CC
For a JavaScript file to be recognized by Photoshop as a valid script file, it must use either a .js or a .jsx
extension.
On the Mac OS, there is no difference in the way scripts with the two extensions function. On Windows, if
the script files is opened from inside Photoshop, there is no difference between using the
.js and .jsx
extension. However, if the script is launched by double-clicking on it, a script with the .js extension is
interpreted with the Microsoft JScript engine, and it cannot launch Adobe Photoshop CC. For Windows,
using the
.jsx extension is preferrable, since it interprets the script with the ExtendScript engine.
All of the Adobe Creative Cloud applications, including Adobe Photoshop CC, use ExtendScript, Adobe’s
extended implementation of JavaScript. ExtendScript files are distinguished by the
.jsx extension.
ExtendScript offers all standard JavaScript features, plus additional features and utilities, such as:
● A debugging environment (the ExtendScript Toolkit)
● A localization utility
● Tools that allow you to combine scripts and direct them to particular applications
● Platform-independent file and folder representation
Many of the JavaScript objects and methods use objects defined in ExtendScript, such as the
Folder object, and the UnitValue object. For that reason, using the .jsx extension for your script
the
File object,
files is preferable.
For details of these and additional features, see the JavaScript Tools Guide . This document is installed with
Creative Cloud applications at these locations:
● In Windows:
C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit CC\SDK
32
Adobe Photoshop CC
JavaScript Scripting Reference Introduction 33
● In Mac OS:
Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CC/SDK
The latest versions of this document and of the ExtendScript Tookit, can also be downloaded from Adobe
Developer Center,
http://www.adobe.com/devnet/.
Executing scripts
The Adobe Photoshop CC interface includes a Scripts menu (File > Scripts ) which provides quick and easy
access to your JavaScripts. Scripts can be listed directly as menu items that run when you select them, or
you can navigate to and run any JavaScript in your file system.
If Adobe Photoshop CC encounters an error during script execution, it displays the error message.
Installing scripts
To install a JavaScript in the Scripts menu, place it in the Scripts folder (Photoshop CC/Presets/ Scripts ).
The names of the scripts in the Scripts folder, without the file name extension, will be displayed in the
Scripts menu. Any number of scripts may be installed in the Scripts menu.
Scripts added to the Scripts folder while Adobe Photoshop CC is running will not appear in the Scripts
menu until the next time you launch the application.
All scripts found in the Scripts folder and sub-folders are displayed at the top level of the File > Scripts
menu. The addition of sub-folders does not add a hierarchical organization to the Scripts menu.
Executing other scripts
The Browse item at the end of the Scripts menu (File > Scripts > Browse ) allows you to execute scripts
which are not installed in the Scripts folder. You can also use Browse to select scripts installed in the Scripts
folder after the application was last launched.
Selecting Browse displays a file browser dialog which allows you to select a script file for execution. Only
.js or .jsx files are displayed in the browse dialog. When you select a script file, it is executed the same
way as an installed script.
Startup scripts
On startup, Adobe Photoshop CC executes all .jsx files that it finds in the startup folders.
● On Windows, the startup folder for user-defined scripts is:
C:\Program Files\Common Files\Adobe\Startup Scripts CC\Adobe Photoshop
● On Mac OS, the startup folder for user-defined scripts is:
~/Library/Application Support/Adobe/Startup Scripts CC/Adobe Photoshop
If a script is meant to be executed only by Adobe Photoshop CC, it must include code such as the
following:
if( BridgeTalk.appName == "photoshop" ) {
//continue executing script
}
For additional details, see the JavaScript Tools Guide.
Adobe Photoshop CC
JavaScript Scripting Reference Introduction 34
Object model usage and naming
The JavaScript API follows JavaScript naming conventions in that all classes (object types) begin with
uppercase letters and have mixed case. Typically, in JavaScript, you instantiate classes using the
operator:
new ClassName();
However, in the Photoshop Object Model, it is often not necessary to do this. Major object types are
collected into collection classes; for example, a list of
Document objects is contained in a Documents
collection object. You then access the collection object through a corresponding collection property in its
container in the object hierarchy.
new
For example, the collection of all open documents is contained in the top-level
can access this through the global variable
app.documents[0] // get the first loaded documented
documents[0] // this is the same
app, or simply reference its properties directly at the top level:
Application object. You
A collection property has the same name as the collection object, but begins with lowercase. For example,
Document contains a collection of LayerSets, and a LayerSet contains a collection of ArtLayers. To
a
access one
var myLayer = activeDocument.layerSets[0].artLayers[0];
ArtLayer object in a set:
The collections, as in this example, can be treated as arrays, which is useful for iteration. They also provide
methods to create their contained objects, and to access them by name:
var newLayer = activeDocument.artLayers.add(); // Create a new ArtLayer object
newLayer.name = "My Layer"; // name it for later reference
...
var layerRef = activeDocument.artLayers.getByName("My Layer");
Some objects, such as the Font objects contained in the app.fonts collection, are created by the
application, and never by your scripts.
Your scripts do use the JavaScript
new operator to create helper objects, such as those that encapsulate a
set of options for opening or saving a document in a particular format:
var opts = new PDFOpenOptions();
opts.page = 10;
app.open(myPDFFile, opts);
2
JavaScript Object Reference
The Photoshop objects (the JavaScript type library for Adobe® Photoshop® CC) are presented
alphabetically and in tabular format in this chapter. Sample code for several object model classes is given
to help illustrate the syntax as well as usage of the object class.
Object descriptions
Object properties and methods are described in separate tables for each object. The following sections
describe the conventions used in these descriptions.
Properties notation
The Properties table for an object lists the following:
● The properties defined in each object.
● The value type for each property.
When the value type is a constant or another object, the value is a hypertext link to the listing for that
constant or object.
● The property’s input status: read-only or read-write.
● A description that explains what the property does.
Property Value type What it is
displayDialogs
For constants, like DialogModes in the sample, click the link to go to the table that shows allowed values.
Constants are represented by objects, and allowed values are properties of those objects. Specify a
constant value in the form ConstantName.VALUE . For example:
app.displayDialogs = DialogModes.ERROR;
Methods notation
The Methods table for an object lists the following:
● The method name.
● The parameters list.
● The parameter value types, on lines corresponding to each parameter.
● Return value type
● A description of what the method does, and further descriptions of parameters, if needed.
DialogModes
Read-write. The dialog mode for the application, which controls
what types of dialogs should be displayed when running
scripts.
35
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 36
Method Parameter type Returns What it does
crop
(bounds
[, angle]
[, width]
[, height])
array of 4
UnitValue
number
UnitValue
UnitValue
Crops the document. The
bounds parameter is an array of
four coordinates for the region
remaining after cropping, [left,
top, right, bottom].
When a parameter type or return value is a constant or another object, the value is a hypertext link to the
listing for that constant or object.
Parameters can be required or optional. Optional parameters are indicated in the table by square brackets
([]). In the example, the first parameters, bounds , is required. The remaining parameters are all optional.
You must pass a value for each required parameter. You can leave out optional parameters if there are no
remaining values to pass; however, if you wish to use the default value for any optional parameter that is
not the last one specified, pass
undefined as a placeholder. You must enter the values in the order they are
listed, so that the JavaScript compiler knows which value you are entering.
For example, the following passes only the required parameter (using a previously-defined variable for the
bounding region):
app.activeDocument.crop( myRegion );
The following skips the angle parameter, specifies the width value, and omits the final height value:
var myWidth = new UnitValue( "500 pixels" );
app.executeAction( myRegion,undefined,myWidth );
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 37
ActionDescriptor
This object provides a dictionary-style mechanism for storing data as key-value pairs. It can be used for
low-level access into Photoshop. See an example of this usage in ‘
Many configuration files use serialized action descriptors to represent their data. It is used, for example, to
encapsulate playback options in Application
Application
Properties
Property Value type What it is
.playbackParameters , and is returned by
.getCustomOptions ().
Selection sample script’ on page 170.
count
typename
Methods
Method Parameter type Returns What it does
clear
erase
fromStream
getBoolean
getClass
getData
()
(key)
(value)
(key)
(key)
(key)
number
string
number
string
number
number
number
Read-only. The number of keys contained in the descriptor.
Read-only. The class name of the referenced
actionDescriptor object.
Clears the descriptor.
Erases a key from the descriptor.
Creates a descriptor from a stream
of bytes; for reading from disk.
boolean
Gets the value of a key of type
boolean.
number
Gets the value of a key of type
class.
string
Gets raw byte data as a string
value.
getDouble
(key)
getEnumerationType
(key)
getEnumerationValue
(key)
getInteger
(key)
getKey
(index)
number
number
number
number
number
number
number
number
number
number
Gets the value of a key of type
double.
Gets the enumeration type of a
key.
Gets the enumeration value of a
key.
Gets the value of a key of type
integer.
Gets the ID of the N th key,
provided by index.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 38
Method Parameter type Returns What it does (Continued)
getLargeInteger
(key)
getList
(key)
getObjectType
(key)
getObjectValue
(key)
getPath
(key)
getReference
(key)
getString
(key)
getType
(key)
getUnitDoubleType
(key)
number
number
number
number
number
number
number
number
number
number
ActionList
number
ActionDescriptor
File
ActionReference
string
DescValueType
number
Gets the value of a key of type
large integer.
Gets the value of a key of type list.
Gets the class ID of an object in a
key of type object.
Gets the value of a key of type
object.
Gets the value of a key of type
File.
Gets the value of a key of type
ActionReference.
Gets the value of a key of type
string.
Gets the type of a key.
Gets the unit type of a key of type
UnitDouble.
getUnitDoubleValue
(key)
hasKey
(key)
isEqual
(otherDesc)
putBoolean
(key,
value)
putClass
(key,
value)
putData
(key,
value)
putDouble
(key,
value)
putEnumerated
(key,
enumType,
value)
number
number
ActionDescriptor
number
boolean
number
number
number
string
number
number
number
number number
number
boolean
boolean
Gets the value of a key of type
UnitDouble.
Checks whether the descriptor
contains the provided key.
Determines whether the
descriptor is the same as another
descriptor.
Sets the value for a key whose type
is boolean.
Sets the value for a key whose type
is class.
Puts raw byte data as a string
value.
Sets the value for a key whose type
is double.
Sets the enumeration type and
value for a key.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 39
Method Parameter type Returns What it does (Continued)
putInteger
(key,
value)
putLargeInteger
(key,
value)
putList
(key,
value)
putObject
(key,
classID,
value)
putPath
(key,
value)
putReference
(key,
value)
putString
(key,
value)
number
number
number
number
number
ActionList
number
number
ActionDescriptor
number
File
number
ActionReference
number
string
Sets the value for a key whose type
is integer.
Sets the value for a key whose type
is large integer.
Sets the value for a key whose type
ActionList object.
is an
Sets the value for a key whose type
is an object, represented by an
Action Descriptor.
Sets the value for a key whose type
is path.
Sets the value for a key whose type
is an object reference.
Sets the value for a key whose type
is string.
putUnitDouble
(key,
unitID,
value)
toStream
()
number
number
number
string
Sets the value for a key whose type
is a unit value formatted as a
double.
Gets the entire descriptor as a
stream of bytes, for writing to disk.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 40
ActionList
This object provides an array-style mechanism for storing data. It can be used for low-level access into
Photoshop.
This object is ideal when storing data of the same type. All items in the list must be of the same type.
You can use the "put" methods, such as putBoolean
list using clear
Note: The
Properties
Property Value type What it is
count
typename
Methods
With the exception of the clear() method, you use the methods of this object to either get the value of a
specific type of data in the list or set (put) the value type.
Method Parameter type Returns What it does
clear
()
(), to append new elements, and can clear the entire
(), but cannot otherwise modify the list.
ActionList object is part of the Action Manager functionality. For details on using the Action
Manager, see the Photoshop CC Scripting Guide .
number
Read-only. The number of commands that comprise the
action.
string
Read-only. The class name of the referenced
ActionList object.
Clears the list.
getBoolean
(index)
getClass
(index)
getData
(index)
getDouble
(index)
getEnumerationType
(index)
getEnumerationValue
(index)
getInteger
(index)
number
number
number
number
number
number
number
boolean
number
string
number
number
number
number
Gets the value of a list element of
type boolean.
Gets the value of a list element of
type class.
Gets raw byte data as a string
value.
Gets the value of a list element of
type double.
Gets the enumeration type of a list
element.
Gets the enumeration value of a
list element.
Gets the value of a list element of
type integer.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 41
Method Parameter type Returns What it does (Continued)
getLargeInteger
(index)
getList
(index)
getObjectType
(index)
getObjectValue
(index)
getPath
(index)
getReference
(index)
getString
(index)
getType
(index)
getUnitDoubleType
(index)
number
number
number
number
number
number
number
number
number
number
ActionList
number
ActionDescriptor
File
ActionReference
string
DescValueType
number
Gets the value of a list element of
type large integer.
Gets the value of a list element of
type list.
Gets the class ID of a list element
of type object.
Gets the value of a list element of
type object.
Gets the value of a list element of
File.
type
Gets the value of a list element of
ActionReference.
type
Gets the value of a list element of
type string.
Gets the type of a list element.
Gets the unit value type of a list
element of type Double.
getUnitDoubleValue
(index)
putBoolean
(value)
putClass
(value)
putData
(value)
putDouble
(value)
putEnumerated
(enumType,
value)
putInteger
(value)
putLargeInteger
(value)
putList
(value)
number
boolean
number
string
number
number
number
number
number
ActionList
number
Gets the unit value of a list
element of type double.
Appends a new value, true or
false.
Appends a new value, a class or
data type.
Appends a new value, a string
containing raw byte data.
Appends a new value, a double.
Appends a new value, an
enumerated (constant) value.
Appends a new value, an integer.
Appends a new value, a large
integer.
Appends a new value, a nested
action list.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 42
Method Parameter type Returns What it does (Continued)
putObject
(classID,
value)
putPath
(value)
putReference
(value)
putString
(value)
putUnitDouble
(classID,
value)
number
ActionDescriptor
File
ActionReference
string
number
number
Appends a new value, an object.
Appends a new value, a path.
Appends a new value, a reference
to an object created in the script.
Appends a new value, a string.
Appends a new value, a unit/value
pair.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 43
ActionReference
This object provides information about what the action is refering to. For example, when referring to the
name of something you might use keyName. The reference would also need to know what name you are
referring to. In this case you could use classDocument for the name of the document or classLayer for the
name of the layer. It can be used for low-level access into Photoshop.Contains data associated with an
ActionDescriptor
Properties
Property Value type What it does
.
typename
Methods
Method Parameter type Returns What it does
getContainer
getDesiredClass
getEnumeratedType
getEnumeratedValue
()
()
()
()
string
Read-only. The class name of the referenced Action
object.
ActionReference
Gets a reference contained in this
reference.
Container references provide
additional pieces to the reference.
This looks like another reference,
but it is actually part of the same
reference.
number
Gets a number representing the
class of the object.
number
number
Gets the enumeration type.
Gets the enumeration value.
getForm
()
getIdentifier
()
getIndex
()
getName
()
getOffset
()
getProperty
()
ReferenceFormType
number
number
string
number
number
Gets the form of this action
reference.
Gets the identifier value for a
reference whose form is identifier.
Gets the index value for a
reference in a list or array.
Gets the name of a reference.
Gets the offset of the object’s
index value.
Gets the property ID value.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 44
Method Parameter type Returns What it does (Continued)
putClass
(desiredClass)
putEnumerated
(desiredClass,
enumType,
value)
putIdentifier
(desiredClass,
value)
putIndex
(desiredClass,
value)
putName
(desiredClass,
value)
putOffset
(desiredClass,
value)
putProperty
(desiredClass,
value)
number
number
number
number
number
number
number
number
number
string
number
number
number
number
Puts a new class form and class
type into the reference.
Puts an enumeration type and ID
into a reference along with the
desired class for the reference.
Puts a new identifier and value into
the reference.
Puts a new index and value into
the reference.
Puts a new name and value into
the reference.
Puts a new offset and value into
the reference.
Puts a new property and value into
the reference.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 45
Application
The Adobe Adobe Photoshop CC application object, which is the root of the object model and provides
access to all other objects. This object provides application-wide information, such as application defaults
and available fonts. It provides many important methods , such as those for opening files and loading
documents.
To access the properties and methods, you can use the pre-defined global variable
var docRef = app.documents.add(800, 600, 72, "docRef", NewDocumentMode.RGB);
The properties and methods of the Application object are also available at the top level; you can omit
references to the
var docRef = documents.add(800, 600, 72, "docRef", NewDocumentMode.RGB);
This usage can be somewhat ambiguous; for clarity, it is recommended that you use an explicit reference
app.
to
Properties
Property Value type What it is
activeDocument
backgroundColor
Application object altogether. For example:
Document
Read-write. The frontmost document.
Setting this property is equivalent to clicking an
open document in the Adobe Photoshop CC
application to bring it to the front of the screen.
Tip: If there is no open document, accessing this
property throws an exception.
SolidColor
Read-write. The default background color and color
style for documents.
app. For example:
build
colorSettings
currentTool
displayDialogs
documents
fonts
foregroundColor
string
string
string
DialogModes
Documents
TextFonts
SolidColor
Read-only. Information about the application.
Read-write. The name of the current color settings,
as selected with Edit > Color Settings.
Read-write. The name of the current tool selected.
Read-write. The dialog mode for the application,
which controls what types of dialogs should be
displayed when running scripts.
Read-only. The collection of open documents.
This is the primary point of access for documents
that are currently open in the application. The array
allows you to access any open document, or to
iterate through all open documents.
Read-only. The fonts installed on this system.
Read-write. The default foreground color (used to
paint, fill, and stroke selections).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 46
Property Value type What it is (Continued)
freeMemory
locale
macintoshFileTypes
measurementLog
name
notifiers
notifiersEnabled
path
number
string
array of string
MeasurementLog
string
Notifiers
boolean
File
Read-only. The amount of unused memory
available to Adobe Photoshop CC.
Read-only. The language location of the
application.
An Adobe locale code consists of a 2-letter ISO-639
language code and an optional 2-letter ISO 3166
country code separated by an underscore. Case is
significant. For example,
fr_FR.
en_US, en_UK, ja_JP, de_DE,
Read-only. A list of file image types Adobe
Photoshop CC can open.
The log of measurements taken.
Read-only. The application's name.
Read-only. The collection of notifiers currently
configured (in the Scripts Events Manager menu in
the Adobe Photoshop CC application).
Read-write. True if all notifiers are enabled.
Read-only. The full path to the location of the
Adobe Photoshop CC application.
playbackDisplayDialogs
playbackParameters
preferences
preferencesFolder
recentFiles
scriptingBuildDate
scriptingVersion
systemInformation
typename
DialogModes
ActionDescriptor
Preferences
File
array of File
string
string
string
string
Read-write. The dialog mode for playback mode,
which controls what types of dialog to display
when playing back a recorded action with the
Actions palette.
Read-write. Stores and retrieves parameters used as
part of a recorded action. Can be used, for example,
to control playback speed.
Read-only. The application preference settings
(equivalent to selecting Edit > Preferences in the
Adobe Photoshop CC application in Windows or
Photoshop > Preferences in Mac OS).
Read-only. The full path to the Preferences folder.
Read-only. Files in the Recent Files list.
Read-only. The build date of the Scripting interface.
Read-only. The version of the Scripting interface.
Read-only. Runtime details of the application and
system.
Read-only. The class name of the referenced app
object.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 47
Property Value type What it is (Continued)
version
string
Read-only. The version of Adobe Photoshop
application you are running.
windowsFileTypes
array of string
Read-only. A list of file image extensions Adobe
Photoshop CC can open.
Methods
Method Parameter type Returns What it does
batch
(inputFiles,
action,
from
[, options])
beep
()
bringToFront
()
changeProgressText
(progressString)
array of File
string
string
BatchOptions
string
string
Runs the batch automation routine
(similar to the File > Automate >
Batch command).
inputFiles parameter specifies
The
the sources for the files to be
manipulated by the batch command.
Causes a "beep" sound.
Makes Adobe Photoshop CC the
active (front-most) application.
Changes the text that appears in the
progress window.
charIDToTypeID
(charID)
compareWithNumbers
(first, second)
string
string
string
number
number
progressString parameter is the
The
string to show in the progress
window.
Converts from a four character code
(character ID) to a runtime ID.
0: They are equal.
Less than 0: Either the value of the
first character that does not match is
lower in the compared string, or all
compared characters match but the
compared string is shorter.
Greater than 0: Either the value of the
first character that does not match is
greater in the compared string, or all
compared characters match but the
compared string is longer.
When a number is encountered it is
converted from a string to a number.
For example, A1, A2, A10 would be
the sorting order, instead of A1, A10,
A2 with the normal sort routine.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 48
Method Parameter type Returns What it does (Continued)
doAction
(action,
from)
doForcedProgress
(progressString,
javaScriptString)
doProgress
(progressString,
javaScriptString)
string
string
string
string
string
string
Plays an action from the Actions
palette. The
name of the action, the
action parameter is the
from
parameter is the name of the action
set.
Performs a task with a progress bar.
Forces progress bar to display,
ignoring the normal heuristics that
keep it from showing unnecessarily
(for example, during very short tasks).
Other progress APIs must be called
periodically to update the progress
bar and allow canceling.
progressString parameter is the
The
string to show in the progress
window, the
javaScriptString
parameter is the string to execute.
Performs a task with a progress bar.
Other progress APIs must be called
periodically to update the progress
bar and allow canceling.
progressString parameter is the
The
string to show in the progress
window, the
javaScriptString
parameter is the string to execute.
doProgressSegmentTask
(segmentLength,
done,
total,
javaScriptString)
number
number
number
string
boolean
Sections-off a portion of the unused
progress bar for execution of a
subtask. Returns false on cancel. This
method should be used when
iterating a list of tasks with unequal
run times.
segmentLength parameter is the
The
length of the current task, the
done
parameter is the total length of all
completed tasks, the
total
parameter is the total length of all
tasks. The
javaScriptString
parameter is the string to execute.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 49
Method Parameter type Returns What it does (Continued)
doProgressSubTask
(index,
limit,
javaScriptString)
doProgressTask
(taskLength,
javaScriptString)
eraseCustomOptions
(key)
number
number
string
number
string
string
boolean
boolean
Sections-off a portion of the unused
progress bar for execution of a
subtask. Returns false on cancel. This
method should be used when
iterating a list of tasks with equal run
times.
index parameter is the 0-based
The
index of the current task, the
limit
parameter is the total number of
tasks, and the
javaScriptString
parameter is the string to execute.
Sections-off a portion of the unused
progress bar for execution of a
subtask. Returns false on cancel.
taskLength parameter is the
The
amount of the unused progress bar to
section-off between 0.0 and 1.0. The
javaScriptString parameter is the
string to execute.
Erases the user object with specified
ID value from the Photoshop registry.
executeAction
(eventID
[, descriptor]
[, displayDialogs])
executeActionGet
(reference)
featureEnabled
(name)
getCustomOptions
(key)
isQuicktimeAvailable
()
load
(document)
number
ActionDescriptor
DialogModes
ActionReference
string
string
File
ActionDescriptor
ActionDescriptor
boolean
ActionDescriptor
boolean
Plays an Action Manager event.
Obtains information about a
predefined or recorded action.
Determines whether the feature
specified by
name is enabled.
The following features are supported
as values for
"photoshop/extended"
"photoshop/standard"
"photoshop/trial"
name:
Retreives user objects in the
Photoshop registry for the ID with
key.
value
Returns true if Quicktime is installed.
Loads a support file (as opposed to a
Photoshop image document) from
the specified location.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 50
Method Parameter type Returns What it does (Continued)
makeContactSheet
(inputFiles
[, options])
makePDFPresentation
(inputFiles,
outputFiles
[, options])
makePhotoGallery
(inputFolder,
outputFolder
[, options])
makePhotomerge
(inputFiles)
makePicturePackage
(inputFiles
[, options])
array of File
ContactSheetOptions
array of File
File
PresentationOptions
File
File
GalleryOptions
array of File
array of File
PicturePackageOptio
ns
string
string
string
string
string
DEPRECATED for Adobe Photoshop CS4.
DEPRECATED for Adobe Photoshop CS4.
DEPRECATED for Adobe Photoshop CS4.
DEPRECATED for Adobe Photoshop CC.
Use provided script:
runphotomergeFromScript = true;
$.evalFile( app.path +
"Presets/Scripts/Photomerge.jsx")
photomerge.createPanorama(
fileList, displayDialog );
Merges multiple files into one, with
user interaction required.
DEPRECATED for Adobe Photoshop CS4.
open
(document
[, as]
[, asSmartObject])
openDialog
()
File
object or
OpenDocumentType
boolean
Document
array of File
Opens the specified document.
Use the optional
as parameter to
specify the file format using the
constants in
OpenDocumentType; or,
you can specify a file format together
with its open options using these
objects:
CameraRAWOpenOptions
DICOMOpenOptions
EPSOpenOptions
PDFOpenOptions
PhotoCDOpenOptions
RawFormatOpenOptions
Use the optional parameter
asSmartObject (default: false) to
create a smart object around the
opened document.
See the Application sample scripts
an example of using the
open method.
in the
File object
for
Invokes the Photoshop Open dialog
box for the user to select files.
Returns an array of
File objects for
the files selected in the dialog.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 51
Method Parameter type Returns What it does (Continued)
purge
(target)
putCustomOptions
(key,
customObject
[, persistent])
refresh
()
refreshFonts
()
runMenuItem
(menuID)
PurgeTarget
string
ActionDescriptor
boolean
number
Purges one or more caches.
Saves a customized settings object in
the Photoshop registry.
key is the unique identifier for your
custom settings.
customObject is the object to save in
the registry.
persistent indicates whether the
object should persist once the script
has finished.
Pauses the script while the
application refreshes. Use to slow
down execution and show the results
to the user as the script runs. Use
carefully; your script runs much more
slowly when using this method.
Force the font list to get updated.
Run a menu item given the menu ID.
showColorPicker
()
stringIDToTypeID
(stringID)
togglePalettes
()
toolSupportsBrushes
(tool)
toolSupportsBrushPresets
(tool)
typeIDToCharID
(typeID)
boolean
number
string
string boolean
string boolean
string
number
Returns false if dialog is cancelled,
true otherwise.
Converts from a string ID to a runtime
ID.
Toggle palette visibility.
Returns true if the specified tool
supports brushes, false otherwise.
Returns true if the brush supports
presets.
Converts from a runtime ID to a
character ID.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 52
Method Parameter type Returns What it does (Continued)
typeIDToStringID
(typeID)
updateProgress
(done,
total)
Application sample scripts
Application.jsx
This script invokes an alert box to display Properties important to an application such as version number,
the path to the application, the amount of memory available, and the number of documents open.
When a user presses the OK button on the alert box, a second dialog opens, which asks users whether they
would like the foreground and background colors set for the document presently open. If no document is
open, the script opens a new document for the user.
The script (with no document open) produces a progression of three dialogs.
//Create a Welcome message
// Use the name and version properties of the application object to
// Append the application’s name and version to the Welcome message
// use "\r" to insert a carriage return
// use the combination operator += to append info to the message
var message = "Welcome to " + app.name
message += " version " + app.version + "\r\r"
number
number
number
string
boolean
Converts from a runtime ID to a string
ID.
Updates the progress bar started by
doProgress method. This method
should be used for manual non-task
based progress updating. Returns
false on cancel.
done parameter is the number of
The
tasks completed and the
total
parameter the total number of tasks.
// find out where Adobe Photoshop CC is installed
// and add the path to the message
// add the optional parameter fsName to the path property
// to display the file system name in the most common format
message += "I’m installed in " + app.path.fsName + "\r\r"
// see how much memory Adobe Photoshop CC has to play with
message += "You have this much memory available for Adobe Photoshop CC: " +
app.freeMemory + "\r\r"
// use the length property of the documents object to
// see how many documents are open
var documentsOpen = app.documents.length
message += "You currently have " + documentsOpen + " document(s) open.\r\r"
// display the message to the user
alert(message)
// answer will be true for a "Yes" answer and false for a "No" answer
var answer = confirm("Set the foreground and background to my favorite colors?")
// set the colors
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 53
if (answer) {
// I don’t have a favorite color. Why did I ask you may wonder?
app.foregroundColor.rgb.red = Math.random() * 255
app.foregroundColor.rgb.green = Math.random() * 255
app.foregroundColor.rgb.blue = Math.random() * 255
app.backgroundColor.rgb.red = Math.random() * 255
app.backgroundColor.rgb.green = Math.random() * 255
app.backgroundColor.rgb.blue = Math.random() * 255
}
// Open a document
if (app.documents.length == 0) {
// use the application’s path and the offset to the samples folder
var sampleDocToOpen = File(app.path + "/Samples/Fish.psd")
// compose a message with the name of the file
message = "Would you like me to open a sample for you? ("
message += sampleDocToOpen.fsName
message += ")"
// ask the user another question
answer = confirm(message)
// open the document accordingly
if (answer) {
open(sampleDocToOpen)
}
}
PDFPresentation.jsx
This script presents a progression of images as an Adobe PDF slide show.
// use all the files in the Samples folder
var inputFolder = new Folder(app.path + "/Samples/")
// see if we have something interesting
if (inputFolder != null) {
// get all the files found in this folder that are Adobe Photoshop CC (.psd
format)
var inputFiles = inputFolder.getFiles("*.psd")
// output to the desktop
var outputFile = File("~/Desktop/JavaScriptPresentation.pdf")
// there are defaults but I like to set the options myself
var options = new PresentationOptions
options.presentation = true
options.view = true
options.autoAdvance = true
options.interval = 5
options.loop = true
options.transition = TransitionType.RANDOM
// create the presentation
makePDFPresentation(inputFiles, outputFile, options)
alert("Presentation file saved to: " + outputFile.fsName)
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 54
}
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 55
ArtLayer
An object within a document that contains the visual elements of the image (equivalent to a layer in the
Adobe Photoshop CC application).
Access an art layer in a document through the Document
name; for example:
var layerRef = app.activeDocument.artLayers.getByName("my layer");
layerRef.allLocked = true;
Access the art layers in a layer set through the LayerSet. artLayers collection in the parent set.
Properties
Property Value type What it is
allLocked
blendMode
bounds
boundsNoEffects
fillOpacity
boolean
BlendMode
array of
UnitValue
array of
UnitValue
number [0.0..100]
.artLayers collection. You can access a layer by
Read-write. True to completely lock the contents and
settings of this layer.
Read-write. The blending mode.
Read-only. An array of coordinates that describes the
bounding rectangle of the layer.
Read-only. An array of coordinates that describes the
bounding rectangle of the layer not including effects.
Read-write. The interior opacity of the layer, a
percentage value.
filterMaskDensity
filterMaskFeather
grouped
isBackgroundLayer
kind
double
double
boolean
boolean
LayerKind
Read-write. The density of the filter mask (between
0.0 and 250.0)
Read-write. The feather of the filter mask (between 0.0
and 250.0)
Read-write. True if this layer is grouped with the layer
beneath it.
Read-write. True if this is the background layer of the
document. A document can have only one
background layer. If there is no background layer,
setting this to true causes this to become the
background layer.
Read-write. Sets the type (such as 'text layer') for an
empty layer.
Valid only when the layer is empty and when
isBackgroundLayer is false. See
isBackgroundLayer
You ca n use th e
.
kind property to make a background
layer a normal layer; however, to make a layer a
background layer, you must set
true.
to
isBackgroundLayer
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 56
Property Value type What it is (Continued)
layerMaskDensity
layerMaskFeather
linkedLayers
name
opacity
parent
pixelsLocked
positionLocked
textItem
transparentPixelsLocked
double
double
array of ArtLayer
or LayerSet
string
number [0.0..100.0].
Document
boolean
boolean
TextItem
boolean
Read-write. The density of the layer mask (between
0.0 and 100.0)
Read-write. The feather of the layer mask (between
0.0 and 250.0)
Read-only. The layers linked to this layer. See
ArtLayer
.link .
Read-write. The name.
Read-write. The master opacity of the layer, a
percentage value.
Read-only. The object's container.
Read-write. True if the pixels in the layer’s image
cannot be edited using the paintbrush tool.
Read-write. True if the pixels in the layer’s image
cannot be moved within the layer.
Read-only. The text item that is associated with the
layer.
Valid only when kind
= LayerKind.TEXT.
Read-write. True if editing is confined to the opaque
portions of the layer.
typename
vectorMaskDensity
vectorMaskFeather
visible
xmpMetadata
string
double
double
boolean
xmpMetadata
Read-only. The class name of the referenced
artLayer object.
Read-write. The density of the vector mask (between
0.0 and 250.0)
Read-write. The feather of the vector mask (between
0.0 and 250.0)
Read-write. True if the layer is visible.
Read-write. Metadata for the layer.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 57
Methods
Method Parameter type Returns What it does
adjustBrightnessContrast
(brightness,
contrast)
adjustColorBalance
([shadows]
[, midtones]
[, highlights]
[, preserveLuminosity]
adjustCurves
(curveShape)
adjustLevels
(inputRangeStart,
inputRangeEnd,
inputRangeGamma,
outputRangeStart,
outputRangeEnd)
number
number
array of number
array of number
array of number
boolean
array of array of number
number
number [(start + 2)..255]
number [0.10..9.99]
number [0..253]
number [(start + 2)..255]
[0..253]
Adjusts the brightness in the
range [-100..100] and contrast
[-100..100].
Adjusts the color balance of the
layer’s component channels. For
shadows, midtones, and
highlights, the array must
include three values in the
range [-100..100], which
represent cyan or red, magenta
or green, and yellow or blue,
when the document mode is
CMYK or RGB.
Document.mode.
See
Adjusts the tonal range of the
selected channel using up to
fourteen points.
Each value in the
curveShape
array is a point pair, an array of
an x and y integer value.
Adjusts the levels of the
selected channels
applyAddNoise
(amount,
distribution,
monochromatic)
applyAverage
()
applyBlur
()
applyBlurMore
()
applyClouds
()
applyCustomFilter
(characteristics,
scale,
offset)
number
NoiseDistribution
boolean
array of number
number
number
[0.1..400]
Applies the Add Noise filter
amount is a percentage value.
Applies the Average filter.
Applies the Blur filter.
Applies the Blur More filter.
Applies the Clouds filter.
Applies a custom filter.
characteristics array has
The
25 members.
See Adobe Photoshop CC Help
for specific instructions.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 58
Method Parameter type Returns What it does (Continued)
applyDeInterlace
(eliminateFields,
createFields)
applyDespeckle
()
applyDifferenceClouds
()
applyDiffuseGlow
(graininess,
glowAmount,
clearAmount)
applyDisplace
(horizontalScale,
verticalScale,
displacement,
undefinedareas,
displacementMapFiles)
applyDustAndScratches
(radius,
threshold)
applyGaussianBlur
(radius)
EliminateFields
CreateFields
number [0..10]
number [0..20]
number [0..20]
number [-999..999]
number [-999..999]
DisplacementMapType
UndefinedAreas
File
number [1..100]
number [0..255]
number [0.1..250.0]
Applies the De-Interlace filter.
Applies the Despeckle filter.
Applies the Difference Clouds
filter.
Applies the Diffuse Glow filter.
Applies the Displace filter using
the specified horizontal and
vertical scale, mapping type,
treatment of undistorted areas,
and path to the distortion
image map.
Applies the Dust & Scratches
filter.
Applies the Gaussian Blur filter
within the specified radius (in
pixels)
applyGlassEffect
(distortion,
smoothness,
scaling
[, invert]
[, texture]
[, textureFile])
applyHighPass
(radius)
number [0..20]
number [1..15]
number [50..200]
boolean
TextureType
File
number [0.1..250.0]
Applies the Glass filter.
scaling is a percentage value.
Applies the High Pass filter
within the specified radius.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 59
Method Parameter type Returns What it does (Continued)
applyLensBlur
([source]
[, focalDistance]
[, invertDepthMap]
[, shape]
[, radius]
[, bladeCurvature]
[, rotation]
[, brightness]
[, threshold]
[, amount]
[, distribution]
[, monochromatic]
)
DepthMapSource
number
boolean
Geometry
number
number
number
number
number
number
NoiseDistribution
boolean
Applies the Lens Blur filter.
source: The source for the
depth map (default:
DepthMapSource.NONE)
focalDistance : The blur focal
distance for the depth map
(default:
invertDepthMask : True if the
0).
depth map is inverted (default:
false).
shape: The shape of the iris
(default:
radius
(default:
bladeCurvature: The blade
curvature of the iris (default:
rotation: The rotation of the
iris (default:
brightness: The brightness for
Geometry.HEXAGON)
: The radius of the iris
15).
0).
0)
the specular highlights (default:
0).
applyLensFlare
(brightness,
flareCenter,
lensType)
applyMaximum
(radius)
applyMedianNoise
(radius)
number
array(UnitValue)
LensType
number [1..100]
number [1..100]
threshold: The threshold for
the specular highlights (default:
0).
amount: The amount of noise
(default:
distribution: The distribution
0)
value for the noise (default:
NoiseDistribution.UNIFORM).
monochromatic: True if the
noise is monochromatic
(default:
false).
Applies the Lens Flare filter with
the specified brightness (0 - 300,
as a percentage), the x and y
coordinates (unit value) of the
flare center, and the lens type.
Applies the Maximum filter
within the specified radius (in
pixels).
Applies the Median Noise filter
within the specified radius (in
pixels).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 60
Method Parameter type Returns What it does (Continued)
applyMinimum
(radius)
applyMotionBlur
(angle,
radius)
applyNTSC
()
applyOceanRipple
(size,
magnitude)
applyOffset
(horizontal,
vertical,
undefinedAreas)
applyPinch
(amount)
applyPolarCoordinates
(conversion)
number [1..100]
number [-360..360]
number [1..999]
number [1..15]
number [0..20]
UnitValue
UnitValue
OffsetUndefinedAreas
number [-100..100]
PolarConversionType
Applies the Minimum filter
within the specified radius (in
pixels) (1 - 100).
Applies the Motion Blur filter.
Applies the NTSC colors filter.
Applies the Ocean Ripple filter.
Moves the layer the specified
amount horizontally and
vertically (min/max amounts
depend on layer size), leaving
an undefined area at the layer’s
original location.
Applies the Pinch filter.
amount is a percentage value.
Applies the Polar Coordinates
filter.
applyRadialBlur
(amount,
blurMethod,
blurQuality
[, blurCenter]
)
applyRipple
(amount,
size)
applySharpen
()
applySharpenEdges
()
applySharpenMore
()
number [1..100]
RadialBlurMethod
RadialBlurQuality
UnitValue
number [-999..999]
RippleSize
Applies the Radial Blur filter in
the specified amount, using
either a spin or zoom effect and
the specified quality. The
parameter
blurCenter is the
position (unit value).
Applies the Ripple filter in the
specified amount, throughout
the image and in the specified
size.
Applies the Sharpen filter.
Applies the Sharpen Edges filter.
Applies the Sharpen More filter.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 61
Method Parameter type Returns What it does (Continued)
applyShear
(curve,
undefinedAreas)
applySmartBlur
(radius,
threshold,
blurQuality,
mode)
applySpherize
(amount,
mode)
applyStyle
(styleName)
applyTextureFill
(textureFile)
array of array of number
UndefinedAreas
number [0.1..100.0]
number [0.1..100.0]
SmartBlurQuality
SmartBlurMode
number [-100..100]
SpherizeMode
string
File
Applies the Shear filter. The
curve defines a curve with
[2..255] points.
Each value in the
curve array is a
point pair, an array of an x and y
integer value.
Applies the Smart Blur filter.
Applies the Spherize filter.
amount is a percentage value.
Applies the specified style to the
layer. You must use a style from
the Styles list in the Layer Styles
Palette.
Applies the Texture Fill filter.
applyTwirl
(angle)
applyUnSharpMask
(amount,
radius,
threshold)
applyWave
(generatorNumber,
minimumWavelength,
maximumWavelength,
minimumAmplitude,
maximumAmplitude,
horizontalScale,
verticalScale,
waveType,
undefinedAreas,
randomSeed)
applyZigZag
(amount,
ridges,
style)
autoContrast
()
number [-999..999]
number [1..500]
number [0.1..250.0]
number [0..255]
number [1..999]
number [1..998]
number [2..min+1]
number[1..998]
number [2..min+1]
number [1..100]
number [1..100]
WaveType
UndefinedAreas
number
number [-100..100]
number [0..20]
ZigZagType
Applies the Twirl filter.
Applies the Unsharp Mask filter.
amount is a percentage value.
(
Applies the Wave filter.
Scale factors are percentage
values.
Applies the Zigzag filter.
Adjusts the contrast of the
selected channels automatically.
autoLevels
()
Adjusts the levels of the
selected channels using the
auto levels option.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 62
Method Parameter type Returns What it does (Continued)
clear
()
copy
([merge])
cut
()
desaturate
()
duplicate
([relativeObject]
[, insertionLocation])
equalize
()
boolean
ArtLayer
ElementPlacement
or LayerSet
ArtLayer
or
LayerSet
Cuts the layer without moving it
to the clipboard.
Copies the layer to the
clipboard. When the optional
argument is set to
true, a
merged copy is performed (that
is, all visible layers are copied to
the clipboard).
Cuts the layer to the clipboard.
Converts a color image to a
grayscale image in the current
color mode by assigning equal
values of each component color
to each pixel.
Creates a duplicate of the object
on the screen.
Redistributes the brightness
values of pixels in an image to
more evenly represent the
entire range of brightness levels
within the image.
invert
()
link
(with)
merge
()
ArtLayer
or LayerSet
ArtLayer
Inverts the colors in the layer by
converting the brightness value
of each pixel in the channels to
the inverse value on the
256-step color-values scale.
Links the layer with the
specified layer.
Merges the layer down,
removing the layer from the
document; returns a reference
to the art layer that this layer is
merged into.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 63
Method Parameter type Returns What it does (Continued)
mixChannels
(outputChannels
[, monochrome])
move
(relativeObject,
insertionLocation)
array of array of number
boolean
ArtLayer
ElementPlacement
or LayerSet
Modifies a targeted (output)
color channel using a mix of the
existing color channels in the
image.
outputChannels
The
parameter is an array of channel
specifications. For each
component channel, specify a
list of adjustment values in the
range [-200..200] followed by a
'constant' value [-200..200].)
monochrome = true, the
When
maximum number of channel
value specifications is 1.
Valid o nly w hen
DocumentMode.RGB
docRef.mode =
or CMYK.
RGB arrays must include four
values. CMYK arrays must
include five values.
Moves the layer relative to the
object specified in parameters.
For art layers, only the constant
ElementPlacement.
values
PLACEBEFORE
and PLACEAFTER
are valid.
photoFilter
([fillColor]
[, density]
[, preserveLuminosity])
posterize
(levels)
rasterize
(target)
remove
()
SolidColor
number [1..100]
boolean
number [2..225]
RasterizeType
For layer sets, only the constant
ElementPlacement.
values
PLACEBEFORE
and INSIDE are
valid.
Adjust the layer’s color balance
and temperature as if a color
filter had been applied.
density is a percentage value.
Specifies the number of tonal
levels for each channel and then
maps pixels to the closest
matching level.
Converts the targeted contents
in the layer into a flat, raster
image.
Deletes the object.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 64
Method Parameter type Returns What it does (Continued)
resize
([horizontal]
[, vertical]
[, anchor])
rotate
(angle
[, anchor])
selectiveColor
(selectionMethod
[, reds]
[, yellows]
[, greens]
[, cyans]
[, blues]
[, magentas]
[, whites]
[, neutrals]
[, blacks])
shadowHighlight
([shadowAmount]
[, shadowWidth]
[, shadowRadius]
[, highlightAmount]
[, highlightWidth]
[, highlightRadius]
[, colorCorrection]
[, midtoneContrast]
[, blackClip]
[, whiteClip])
number
number
AnchorPosition
number
AnchorPosition
AdjustmentReference
array of number
array of number
array of number
array of number
array of number
array of number
array of number
array of number
array of number
number [0..100]
number [0.100]
number [0..2500]
number [0..100]
number [0..100]
number [0..2500]
number [-100..100]
number [-100..100]
number [0.000..50.000]
number [0.000..50.000]
Resizes the layer to the specified
dimensions (as a percentage of
its current size) and places it in
the specified position.
Rotates rotates the layer around
the specified anchor point
(default:
MIDDLECENTER).
Modifies the amount of a
process color in a specified
primary color without affecting
the other primary colors.
Each color array must have four
values.
Adjusts the range of tones in the
image’s shadows and highlights.
Amounts and widths are
percentage values. Radius
values are in pixels.
threshold
(level)
number [1..255]
Converts grayscale or color
images to high-contrast, B/W
images by converting pixels
lighter than the specified
threshold to white and pixels
darker than the threshold to
black.
translate
([deltaX]
[, deltaY])
unlink
()
UnitValue
UnitValue
Moves the layer the specified
amount (in the given unit)
relative to its current position.
Unlinks the layer.
ArtLayer sample Script
The following script opens all the files in the samples folder, creating one multi-layered document. Each
layer is pasted into one of four quadrants and given 50% transparency. Finally the layers are sorted by
name.
ArtLayer.jsx
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 65
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CC to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
//Close all the open documents
while (app.documents.length) {
app.activeDocument.close()
}
// Create a new document to merge all the samples into
var mergedDoc = app.documents.add(1000, 1000, 72, "Merged Samples",
NewDocumentMode.RGB, DocumentFill.TRANSPARENT, 1)
// Use the path to the application and append the samples folder
var samplesFolder = Folder(app.path + "/Samples/")
//Get all the files in the folder
var fileList = samplesFolder.getFiles()
// open each file
for (var i = 0; i < fileList.length; i++) {
// The fileList is folders and files so open only files
if (fileList[i] instanceof File) {
open(fileList[i])
// use the document name for the layer name in the merged document
var docName = app.activeDocument.name
// flatten the document so we get everything and then copy
app.activeDocument.flatten()
app.activeDocument.selection.selectAll()
app.activeDocument.selection.copy()
// don’t save anything we did
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)
// make a random selection on the document to paste into
// by dividing the document up in 4 quadrants and pasting
// into one of them by selecting that area
var topLeftH = Math.floor(Math.random() * 2)
var topLeftV = Math.floor(Math.random() * 2)
var docH = app.activeDocument.width.value / 2
var docV = app.activeDocument.height.value / 2
var selRegion = Array(Array(topLeftH * docH, topLeftV * docV),
Array(topLeftH * docH + docH, topLeftV * docV),
Array(topLeftH * docH + docH, topLeftV * docV + docV),
Array(topLeftH * docH, topLeftV * docV + docV),
Array(topLeftH * docH, topLeftV * docV))
app.activeDocument.selection.select(selRegion)
app.activeDocument.paste()
// change the layer name and opacity
app.activeDocument.activeLayer.name = docName
app.activeDocument.activeLayer.fillOpacity = 50
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 66
}
}
// sort the layers by name
for (var x = 0; x < app.activeDocument.layers.length; x++) {
for (var y = 0; y < app.activeDocument.layers.length - 1 - x; y++) {
// Compare in a non-case sensitive way
var doc1 = app.activeDocument.layers[y].name
var doc2 = app.activeDocument.layers[y + 1].name
if (doc1.toUpperCase() > doc2.toUpperCase()) {
app.activeDocument.layers[y].move(app.activeDocument.layers[y+1],
ElementPlacement.PLACEAFTER)
}
}
}
// Reset the application preferences
app.preferences.rulerUnits = startRulerUnits
app.preferences.typeUnits = startTypeUnits
app.displayDialogs = startDisplayDialogs
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 67
ArtLayers
The collection of ArtLayer objects in a document or layer set.
Access through the Document
var layerRef = docRef.artLayers.add()
Properties
Property Value type What it is
length
parent
typename
Methods
Method Parameter type Returns What it does
add
()
getByName
(name)
.artLayers or LayerSet .artLayers collection. For example:
number
Read-only. The number of elements in the artLayers
collection.
Document
string
Read-only. The object's container.
Read-only. The class name of the referenced
artLayers object.
ArtLayer
Creates a new art layer in the
document and adds the new object to
this collection.
string
ArtLayer
Get the first element in the artLayers
collection with the provided name.
removeAll
()
Removes all elements from the
artLayers collection.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 68
BatchOptions
Options for running a batch operation using the Application. batch () method.
JavaScript only supports folders as sources for batch commands. Specify the batch source folder as the
inputFiles parameter of the Application. batch () method.
Properties
Property Value type What it is
destination
destinationFolder
errorFile
fileNaming
macintoshCompatible
BatchDestinationType
Folder
File
array of
FileNamingType
boolean
Read-write. The type of destination for the
processed files (default:
BatchDestinationType.NODESTINATION).
Read-write. The folder location for the processed
files.
Valid only when destination
BatchDestinationType.FOLDER.
=
Read-write. The file in which to log errors
encountered.
To display errors on the screen (and stop batch
processing when errors occur) leave blank.
Read-write. A list of file naming options
(maximum: 6).
Valid only when destination
BatchDestinationType.FOLDER.
=
Read-write. True to make the final file names
Macintosh compatible (default:
Valid only when destination
BatchDestinationType.FOLDER.
true).
=
overrideOpen
overrideSave
startingSerial
suppressOpen
boolean
boolean
number
boolean
Read-write. True to override action open
commands (default:
false).
Read-write. True to override save as action steps
with the specified destination (default:
Valid only when destination
BatchDestinationType.FOLDER or
SAVEANDCLOSE
.
=
false).
Read-write. The starting serial number to use in
naming files (default:
Valid only when destination
BatchDestinationType.FOLDER.
1).
=
Read-write. True to suppress the file open options
dialogs (default:
false).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 69
Property Value type What it is (Continued)
suppressProfile
typename
unixCompatible
windowsCompatible
boolean
string
boolean
boolean
Read-write. True to suppress the color profile
warnings (default:
false).
Read-only. The class name of the referenced
batchOptions object.
Read-write. True to make the final file name Unix
compatible (default:
Valid only when destination
BatchDestinationType.FOLDER.
true).
=
Read-write. True to make the final file names
Windows compatible (default:
Valid only when destination
BatchDestinationType.FOLDER.
true).
=
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 70
BitmapConversionOptions
Options for converting an image to bitmap mode, using Document. changeMode () with
ChangeMode.Bitmap.
Convert color images to grayscale before converting the image to bitmap mode. See the
ArtLayer
Properties
Property Value type What it is
.desaturate() method.
angle
frequency
method
patternName
resolution
number [-180..180]
number [1.0..999.99]
BitmapConversionType
string
number
Read-write. The angle (in degrees) at which to
orient individual dots. See shape
Valid only when method
BitmapConversionType.HALFTONESCREEN.
=
.
Read-write. The number of printer dots (per inch) to
use.
Valid only when method
BitmapConversionType.HALFTONESCREEN
=
.
Read-write. The conversion method to use (default:
BitmapConversionType.DIFFUSIONDITHER).
Read-write. The name of the pattern to use.
For information about pre-installed valid patterns,
see Adobe Photoshop CC Help on the bitmap
conversion command, or view the options availabe
in the Custom Color drop down box after choosing
the bitmap conversion command.
Valid only when method
BitmapConversionType.CUSTOMPATTERN
=
.
Read-write. The output resolution in pixels per inch
(default:
72.0).
shape
typename
BitmapHalfToneType
string
Read-write. The dot shape to use.
Valid only when method
BitmapConversionType.HALFTONESCREEN
=
Read-only. The class name of the referenced
bitmapConversionOptions object.
.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 71
BMPSaveOptions
Options for saving a document in BMP format using the Document. saveAs () method.
Properties
Property Value type What it is
alphaChannels
depth
flipRowOrder
osType
rleCompression
typename
boolean
BMPDepthType
boolean
OperatingSystem
boolean
string
Read-write. True to save the alpha channels.
Read-write. The number of bits per channel.
Read-write. True to write the image from top
to bottom (default:
Available only when osType
OperatingSystem.WINDOWS
false).
=
.
Read-write. The target OS.
(default:
OperatingSystem.WINDOWS).
Read-write. True to use RLE compression.
Available only when osType
OperatingSystem.WINDOWS
=
.
Read-only. The class name of the referenced
BMPSaveOptions object.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 72
CameraRAWOpenOptions
Options for opening a document in Camera RAW format using the Application. open () method.
Properties
Property Value type What it is
bitsPerChannel
blueHue
blueSaturation
brightness
chromaticAberrationBY
chromaticAberrationRC
colorNoiseReduction
colorSpace
contrast
exposure
greenHue
greenSaturation
luminanceSmoothing
BitsPerChannelType
number [-100..100]
number [-100..100]
number [0..150]
number [-100..100]
number [-100..100]
number [0..100]
ColorSpaceType
number [-50..100]
number [-4.0..4.0]
number [-100..100]
number [-100..100]
number [0..100]
Read-write. The number of bits per channel.
Read-write. The blue hue of the shot.
Read-write. The blue saturation of the shot.
Read-write. The brightness of the shot.
Read-write. The chromatic aberration B/Y of the
shot.
Read-write. The chromatic aberration R/C of the
shot
Read-write. The color noise reduction of the
shot.
Read-write. The colorspace for the image.
Read-write. The contrast of the shot.
Read-write. The exposure of the shot.
Read-write. The green hue of the shot.
Read-write. The green saturation of the shot.
Read-write. The luminance smoothing of the
shot.
redHue
redSaturation
resolution
saturation
settings
shadows
shadowTint
sharpness
size
temperature
number [-100..100]
number [-100..100]
number [1..999]
number [-100..100]
CameraRAWSettingsType
number [0..100]
number [-100..100]
number [0..100]
CameraRAWSize
number [2000..50000]
Read-write. The red hue of the shot.
Read-write. The red saturation of the shot.
Read-write. The resolution of the document in
pixels per inch.
Read-write. The saturation of the shot.
Read-write. The global settings for all Camera
RAW options. Default:
CameraRAWSettingsType.CAMERA.
Read-write. The shadows of the shot.
Read-write. The shadow tint of the shot.
Read-write. The sharpness of the shot.
Read-write. The size of the new document.
Read-write. The temperature of the shot.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 73
Property Value type What it is (Continued)
tint
typename
vignettingAmount
vignettingMidpoint
whiteBalance
number [-150..150]
string
number [-100..100]
number [-100..100]
WhiteBalanceType
Read-write. The tint of the shot.
Read-only. The class name of the referenced
cameraRAWOpenOptions object.
Read-write. The vignetting amount of the shot.
Read-write. The vignetting mid point of the
shot.
Read-write. The white balance options for the
image. These are lighting conditions that affect
color balance.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 74
Channel
Information about a color element in the image.
Access through the Document
by index or by name. For example, this accesses a channel object in the active document by name and
assigns an
var channelRef = app.activeDocument.channels.getByName("my channel");
channelRef.opacity = 22;
A channel is analogous to a plate in the printing process that applies a single color. The document’s color
mode determines the number of default channels; for example, an RGB document has three channels, red,
green, and blue. A color can also have an alpha channel, which stores selections as masks, or a spot
channel, which stores spot colors.
Properties
Property Value type What it is
color
histogram
opacity value:
.channels collection. You can access an individual channel object in this list
SolidColor
array of number
Read-write. The color of the channel.
Not valid when
kind = ChannelType.COMPONENT.
Read-only. A histogram of the color of the channel. The
array contains 256 members.
Not valid when
kind = ChannelType.COMPONENT. For
component channel histogram values, use the histogram
property of the Document
object instead.
kind
name
opacity
parent
typename
visible
Methods
Method Parameter type Returns What it does
duplicate
([targetDocument])
ChannelType
string
number [0..100]
Document
string
boolean
Document
Read-write. The type of the channel.
Read-write. The name of the channel.
Read-write. The opacity to use for alpha channels or the
solidity to use for spot channels.
Valid only when
SELECTEDAREA.
kind = ChannelType.MASKEDAREA or
Read-only. The containing document.
Read-only. The class name of the referenced channel
object.
Read-write. True if the channel is visible.
Channel
Duplicates the channel.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 75
Method Parameter type Returns What it does
merge
()
remove
()
Merges a spot channel into the
component channels.
Deletes the channel.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 76
Channels
The collection of Channel objects in a document.
Access through the Document
var channelRef = app.activeDocument.channels.add()
Properties
Property Value type What it is
length
parent
typename
Methods
Method Parameter type Returns What it does
add
()
getByName
(name)
.channels collection property. For example:
number
Read-only. The number of elements in the channels
collection.
Document
string
Read-only. The containing document.
Read-only. The class name of the referenced channels
object.
Channel
Channel
string
Creates a new channel object and
adds it to this collection.
Get the first element in the channels
collection with the provided name.
removeAll
()
Removes all alpha channel objects
from the
channels collection.
Channels sample script
The following script opens a file if one is not already open, and then writes a histogram report
(histogram.log) for the channels in the active document.
Note: This script contains a switch construction that uses a
requires an ending semicolon (;), as in the following sample:
break;
Histogram.jsx
// Function to activate all the channels according to the documents mode
// Takes a document reference for input
function TurnOnDocumentHistogramChannels(inDocument) {
// see how many channels we need to activate
var visibleChannelCount = 0
// based on the mode of the document
switch (inDocument.mode) {
break statement. The break statement
case DocumentMode.BITMAP:
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 77
case DocumentMode.GRAYSCALE:
case DocumentMode.INDEXEDCOLOR:
visibleChannelCount = 1
break;
case DocumentMode.DUOTONE:
visibleChannelCount = 2
break;
case DocumentMode.RGB:
case DocumentMode.LAB:
visibleChannelCount = 3
break;
case DocumentMode.CMYK:
visibleChannelCount = 4
break;
case DocumentMode.MULTICHANNEL:
default:
visibleChannelCount = inDocument.channels.length + 1
break;
}
// now get the channels to activate into a local array
var aChannelArray = new Array()
// index for the active channels array
var aChannelIndex = 0
for(var channelIndex = 0; channelIndex < inDocument.channels.length;
channelIndex++) {
if (channelIndex < visibleChannelCount) {
aChannelArray[aChannelIndex++] = inDocument.channels[channelIndex]
}
}
// now activate them
inDocument.activeChannels = aChannelArray
}
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CC to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
// if there are no documents open then try to open a sample file
if (app.documents.length == 0) {
open(File(app.path + "/Samples/Fish.psd"))
}
// get a reference to the working document
var docRef = app.activeDocument
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 78
// create the output file
// first figure out which kind of line feeds we need
if ($.os.search(/windows/i) != -1) {
fileLineFeed = "Windows"
} else {
fileLineFeed = "Macintosh"
}
// create the output file accordingly
fileOut = new File("~/Desktop/Histogram.log")
fileOut.lineFeed = fileLineFeed
fileOut.open("w", "TEXT", "????")
// write out a header
fileOut.write("Histogram report for " + docRef.name)
// find out how many pixels I have
var totalCount = docRef.width.value * docRef.height.value
// more info to the out file
fileOut.write(" with a total pixel count of " + totalCount + "\n")
// channel indexer
var channelIndex = 0
// remember which channels are currently active
var myActiveChannels = app.activeDocument.activeChannels
// document histogram only works in these modes
if (docRef.mode == DocumentMode.RGB ||
docRef.mode == DocumentMode.INDEXEDCOLOR ||
docRef.mode == DocumentMode.CMYK) {
// activate the main channels so we can get the documents histogram
TurnOnDocumentHistogramChannels(docRef)
// Output the documents histogram
OutputHistogram(docRef.histogram, "Luminosity", fileOut)
}
// local reference to work from
var myChannels = docRef.channels
// loop through each channel and output the histogram
for (var channelIndex = 0; channelIndex < myChannels.length; channelIndex++) {
// the channel has to be visible to get a histogram
myChannels[channelIndex].visible= true
// turn off all the other channels
for (var secondaryIndex = 0; secondaryIndex < myChannels.length;
secondaryIndex++) {
if (channelIndex != secondaryIndex) {
myChannels[secondaryIndex].visible= false
}
}
// Use the function to dump the histogram
OutputHistogram(myChannels[channelIndex].histogram,
myChannels[channelIndex].name, fileOut)
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 79
}
// close down the output file
fileOut.close()
alert("Histogram file saved to: " + fileOut.fsName)
// reset the active channels
docRef.activeChannels = myActiveChannels
// Reset the application preferences
app.preferences.rulerUnits = startRulerUnits
app.preferences.typeUnits = startTypeUnits
app.displayDialogs = startDisplayDialogs
// Utility function that takes a histogram and name
// and dumps to the output file
function OutputHistogram(inHistogram, inHistogramName, inOutFile) {
// find ouch which count has the largest number
// I scale everything to this number for the output
var largestCount = 0
// a simple indexer I can reuse
var histogramIndex = 0
// see how many samples we have total
var histogramCount = 0
// search through all and find the largest single item
for (histogramIndex = 0; histogramIndex < inHistogram.length;
histogramIndex++) {
histogramCount += inHistogram[histogramIndex]
if (inHistogram[histogramIndex] > largestCount)
largestCount = inHistogram[histogramIndex]
}
// These should match
if (histogramCount != totalCount) {
alert("Something bad is happening!")
}
// see how much each "X" is going to count as
var pixelsPerX = largestCount / 100
// output this data to the file
inOutFile.write("One X = " + pixelsPerX + " pixels.\n")
// output the name of this histogram
inOutFile.write(inHistogramName + "\n")
// loop through all the items and output in the following format
// 001
// 002
for (histogramIndex = 0; histogramIndex < inHistogram.length;
histogramIndex++) {
// I need an extra "0" for this line item to keep everything in line
if (histogramIndex < 10)
inOutFile.write("0")
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 80
// I need an extra "0" for this line item to keep everything in line
if (histogramIndex < 100)
inOutFile.write("0")
// output the index to file
inOutFile.write(histogramIndex)
// some spacing to make it look nice
inOutFile.write(" ")
// figure out how many X’s I need
var outputX = inHistogram[histogramIndex] / largestCount * 100
// output the X’s
for (var a = 0; a < outputX; a++)
inOutFile.write("X")
inOutFile.write("\n")
}
inOutFile.write("\n")
}
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 81
CMYKColor
Defines a CMYK color, used in the SolidColor object.
See also GrayColor
Properties
Property Value type What it is
black
cyan
magenta
typename
yellow
, HSBColor , LabColor , NoColor , RGBColor
number [0.0..100.00]
number [0.0..100.00]
number [0.0..100.00]
string
Read-write. The black color value (as percent).
Read-write. The cyan color value (as percent).
Read-write. The magenta color value (as percent).
Read-only. The class name of the referenced CMYKColor
object.
number [0.0..100.00]
Read-write. The yellow color value (as percent).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 82
ColorSampler
A color sampler for a document. Access through the Document. colorSamplers collection. For example:
var colorSamplerRef = app.activeDocument.colorSamplers[0];
var currentColor = colorSamplerRef.color;
Note: For additional information about color samplers, see Adobe Photoshop CC help on the Color
SamplerTool.
Properties
Property Value type What it is
color
position
parent
typename
Methods
Method Parameter type Returns What it does
move
remove
(position)
()
SolidColor
array of
UnitValue
Document
string
array of
UnitValue
Read-only. The color of the color sampler.
Read-only. The position of the color sampler in the
document. The array (x,y) represents the horizontal and
vertical location of the count item.
Read-only. The containing document.
Read-only. The class name of the referenced ColorSampler
object.
Moves the color sampler to a new location
in the document.
position parameter (x,y) represents
The
the new horizontal and vertical locations
of the moved color sampler.
Deletes the ColorSampler object.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 83
ColorSamplers
The collection of ColorSampler objects in a document. Access through the Document. colorSamplers
collection property. For example:
app.activeDocument.colorSamplers.removeAll()
Properties
Property Value type What it is
length
parent
typename
Methods
Method Parameter type Returns What it does
add
removeAll
(position)
()
number
Document
string
array of UnitValue
Read-only. The number of elements in the
ColorSamplers collection.
Read-only. The containing document.
Read-only. The class name of the referenced
ColorSamplers object.
ColorSampler
Creates a new color sampler object
and adds it to this collection.
position parameter (x,y)
The
represents the new horizontal and
vertical locations of the moved color
sampler.
Removes all ColorSampler objects
from the
ColorSamplers collection.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 84
ContactSheetOptions
Options for creating a contact sheet with the Application. makeContactSheet () method.
Properties
Property Value type What it is
acrossFirst
bestFit
caption
columnCount
flatten
font
fontSize
height
horizontal
boolean
boolean
boolean
number[1..100]
boolean
GalleryFontType
number
number [0..29000]
number
Read-write. True to place the images horizontally
(left to right, then top to bottom) first (default:
true).
Read-write. True to rotate images for the best fit
(default:
false).
Read-write. True to use the filename as a caption for
the image (default:
true).
Read-write. The number of columns to include
(default:
5).
Read-write. True to flatten all layers in the final
document (default:
true).
Read-write. The font used for the caption (default:
GalleryFontType.ARIAL).
Read-write. The font size to use for the caption
(default:
12).
Read-write. The height (in pixels) of the resulting
document (default:
720).
Read-write. The horizontal spacing (in pixels)
between images (default:
1).
mode
resolution
rowCount
typename
useAutoSpacing
vertical
width
NewDocumentMode
number [35..1200]
number [1..100]
string
boolean
number [0..29000]
number [100..29000]
Read-write. The document color mode (default:
NewDocumentMode.RGB).
Read-write. The resolution of the document in pixels
per inch (default:
72.0).
Read-write. The number of rows to use (default: 6 ).
Read-only. The class name of the referenced
contactSheetOptions object.
Read-write. True to auto space the images (default:
true).
Read-write. The vertical spacing (in pixels) between
images (default:
Valid only when
1).
useAutoSpacing = false.
Read-write. The width (in pixels) of the resulting
document (default:
576).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 85
CountItem
A counted item in a document. Access through the Document. countItems collection. See the
Document
Note: This feature is available in the Extended Version only.
For additional information about count items, see Adobe Photoshop CC help on the Count Tool.
Properties
Property Value type What it is
.autoCount () method.
position
parent
typename
Methods
Method Parameter type Returns What it does
remove
()
array of
UnitValue
Document
string
Read-only. The position of the count item in the document.
Read-only. The containing document.
Read-only. The class name of the referenced CountItem
object.
Deletes the CountItem object.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 86
CountItems
The collection of CountItem objects in the document.
Access through the Document
app.activeDocument.countItems.removeAll()
Note: This feature is available in the Extended Version only.
Properties
Property Value type What it is
length
parent
typename
Methods
Method Parameter type Returns What it does
add
(position)
.countItems collection property. For example:
number
Read-only. The number of elements in the CountItems
collection.
Document
string
Read-only. The containing document.
Read-only. The class name of the referenced CountItems
object.
CountItem
array of UnitValue
Creates a new count item object and
adds it to this collection.
getByName
(name)
removeAll
()
string
CountItem
Parameter
position (x,y) represents
the horizontal and vertical positions,
respectively, of the
CountItem object.
Get the first element in the
CountItems collection with the
provided name.
Removes all CountItem objects from
CountItems collection .
the
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 87
DCS1_SaveOptions
Options for saving a CMYK document in DCS1 format using the Document. saveAs () method.
Properties
Property Value type What it is
dCS
embedColorProfile
encoding
halftoneScreen
interpolation
preview
transferFunction
typename
vectorData
DCSType
boolean
SaveEncoding
boolean
boolean
Preview
boolean
string
boolean
Read-write. (default: DCSType.COLORCOMPOSITE).
Read-write. True to embed the color profile in the
document
Read-write. The type of encoding to use for document
(default:
SaveEncoding.BINARY).
Read-write. True to include halftone screen (default:
false).
Read-write. True to use image interpolation (default:
false)
Read-write. The type of preview (default:
Preview.MACOSEIGHTBIT).
Read-write. True to include the Transfer functions to
compensate for dot gain between the image and film
(default:
false).
Read-only. The class name of the referenced
DCS1_SaveOptions object.
Read-write. True to include vector data.
Valid only if the document includes vector data
(unrasterized text).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 88
DCS2_SaveOptions
Options for saving a CMYK document in DCS2 format using the Document. saveAs () method.
Properties
Property Value type What it is
dCS
embedColorProfile
encoding
halftoneScreen
interpolation
multiFileDCS
preview
spotColors
transferFunction
DCSType
boolean
SaveEncoding
boolean
boolean
boolean
Preview
boolean
boolean
Read-write. The type of composite file to create
(default:
DCSType.NOCOMPOSITE).
Read-write. True to embed the color profile in the
document.
Read-write. The type of encoding to use (default:
SaveEncoding.BINARY).
Read-write. True to include the halftone screen
(default:
false).
Read-write. True to use image interpolation (default:
false).
Read-write. True to save color channels as multiple
files or a single file (default:
false).
Read-write. The preview type (default:
Preview.MACOSEIGHTBIT).
Read-write. True to save spot colors.
Read-write. True to include the Transfer functions to
compensate for dot gain between the image and film
(default:
false).
typename
vectorData
string
boolean
Read-only. The class name of the referenced
DCS2_SaveOptions object.
Read-write. True to include vector data.
Valid only if the document includes vector data
(unrasterized text).
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 89
DICOMOpenOptions
Options for opening a document in DICOM format using the Application.open () method.
Note: This feature is available in the Extended Version only.
Properties
Property Value type What it is
anonymize
columns
reverse
rows
showOverlays
typename
windowLevel
windowWidth
boolean
number
boolean
number
boolean
string
number
number
Read-write. True to make the patient
information anonymous.
Read-write. Number of columns in n-up
configuration.
Read-write. True to reverse (invert) the image.
Read-write. The number of rows in n-up
configuration.
Read-write. True to show overlays.
Read-only. The class name of the referenced
DICOMOpenOptions object.
Read-write. The contrast of the image in
Houndsfield units.
Read-write. The brightness of the image in
Houndsfield units.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 90
Document
The active containment object for layers and all other objects in the script; the basic canvas for the file.
● Access the object for the currently active document through Application. activeDocument.
● You can access other documents, or iterate through all open documents using the list in the
Application
Documents
● Create documents programmatically using the Documents. add () method.
.documents collection. You can access individual documents in the list by index, or use
.getByName () to retrieve them by name.
See Document sample script
Note: In Adobe Photoshop CC, a document can also be referred to as an image or a canvas.
Properties
Property Value type What it is
activeChannels
activeHistoryBrushSource
activeHistoryState
activeLayer
artLayers
backgroundLayer
and the Documents collection object for examples.
● The term image refers to the entire document and its contents. You can trim or crop an image.
You resize an image using the
● The term canvas refers to the space in which the document sits on the screen. You can rotate or
flip the canvas. You resize the canvas using the
array of Channel
Guide
resizeImage() method.
resizeCanvas() method.
Read-write. The selected channels.
Read-write. The history state to use with the
history brush.
Guide
ArtLayer or
LayerSet
ArtLayers
ArtLayer
Read-write. The selected HistoryState object.
Read-write. The selected layer.
Read-only. The art layers collection.
Read-only. The background layer of the
document.
bitsPerChannel
channels
colorProfileName
colorProfileType
colorSamplers
componentChannels
BitsPerChannelType
Channels
string
ColorProfileType
ColorSamplers
array of Channel
Read-write. The number of bits per channel.
Read-only. The channels collection.
Read-write. The name of the color profile.
Valid only when colorProfileType
ColorProfile.CUSTOM
or WORKING .
=
Read-write. Whether the document uses the
working color profile, a custom profile, or no
profile.
Read-only. The current color samplers
associated with this document.
Read-only. The color channels that make up
the document; for instance, the Red, Green,
and Blue channels for an RGB document.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 91
Property Value type What it is (Continued)
countItems
fullName
guides
height
histogram
historyStates
info
layerComps
CountItems
File
Guides
UnitValue
array of number
HistoryStates
DocumentInfo
LayerComps
Read-only. The current count items.
Note: For additional information about count
items, see Adobe Photoshop CC help on
the Count Tool.
Read-only. The full path name of the
document.
Read-only. The guides collection.
Read-only. The height of the document (unit
value).
Read-only. A histogram showing the number
of pixels at each color intensity level for the
composite channel. The array c ontains 256
members.
Valid only when mode
CMYK; or INDEXEDCOLOR.
= DocumentMode.RGB,
Read-only. The history states collection.
Read-only. Metadata about the document.
Read-only. The layer compositions collection.
layers
layerSets
managed
measurementScale
mode
name
parent
path
pathItems
pixelAspectRatio
Layers
LayerSets
boolean
MeasurementScale
DocumentMode
string
Application
File
PathItems
number
[0.100..10.000]
Read-only. The layers collection.
Read-only. The layer set collection.
Read-only. True if the document a is workgroup
document.
Read-only. The measurement scale for the
document.
Note: The measurement scale feature is
available in the Extended version only.
Read-only. The color profile.
Read-only. The document's name.
Read-only. The application object that contains
this document.
Read-only. The path to the document.
Read-only. The path items collection.
Read-write. The (custom) pixel aspect ratio to
use.
printSettings
DocumentPrintSettin
gs
Read-only. The print settings for the document.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 92
Property Value type What it is (Continued)
quickMaskMode
resolution
saved
selection
typename
width
xmpMetadata
boolean
number
boolean
Selection
string
UnitValue
xmpMetadata
Read-write. True if the document is in Quick
Mask mode.
Read-only. The document’s resolution (in pixels
per inch).
Read-only. True if the document has been
saved since the last change.
Read-only. The selected area of the document.
Read-only. The class name of the Document
object.
Read-only. The width of the document (unit
value).
Read-only. XMP metadata for the document.
Camera RAW settings for the image are stored
here for example.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 93
Methods
Method Parameter type Returns What it does
autoCount
(channel,
threshold)
changeMode
(destinationMode
[, options])
close
([saving])
convertProfile
(destinationProfile,
intent
[, blackPointCompensation]
[, dither])
Channel
number
ChangeMode
BitmapConversionOptions
or
IndexedConversionOptions
SaveOptions
string
Intent
boolean
boolean
Counts the number of objects in a
document. Available in the Extended
Version only.
Creates a CountItem
object for each
object counted.
For additional information about how to
set up objects to count, see the Count Tool
in the Adobe Photoshop CC Help
Changes the color profile of the
document.
Closes the document. If any changes have
been made, the script presents an alert
with three options: save, do not save,
prompt to save. The optional parameter
specifies a selection in the alert box
(default:
PROMPTTOSAVECHANGES
SaveOptionsType.
).
Changes the color profile.
destinationProfile
The
parameter must
be either a string that names the color
mode or
Working Gray, Lab Color (meaning one
Working RGB, Working CMYK,
of the working color spaces or Lab color).
crop
(bounds
[, angle]
[, width]
[, height])
duplicate
([name ]
[, mergeLayersOnly]
)
array of 4 UnitValue
number
UnitValue
UnitValue
string
boolean
Document
Crops the document. The bounds
parameter is an array of four coordinates
for the region remaining after cropping,
[left, top, right, bottom].
Creates a duplicate of the document
object.
The optional parameter
name provides the
name for the duplicated document.
The optional parameter
mergeLayersOnly indicates whether to
only duplicate merged layers.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 94
Method Parameter type Returns What it does (Continued)
exportDocument
(exportIn
[, exportAs]
[, options])
flatten
()
flipCanvas
(direction)
importAnnotations
(file)
mergeVisibleLayers
()
paste
([intoSelection])
print
([sourceSpace]
[, printSpace]
[, intent]
[blackPointCompensation])
File
ExportType
ExportOptionsIllustrator
—or—
ExportOptionsSaveForWeb
Direction
File
boolean
SourceSpaceType
string
Intent
boolean
ArtLayer
Exports the paths in the document to an
Illustrator file, or exports the document to
a file with Web or device viewing
optimizations.
This is equivalent to choosing File >
Export > Paths To Illustrator, or File >
Save For Web and Devices.
Flattens all layers in the document.
Flips the image within the canvas in the
specified direction.
Imports annotations into the document.
Flattens all visible layers in the document.
Pastes the contents of the clipboard into
the document. If the optional argument is
true and a selection is active, the
set to
contents are pasted into the selection.
Prints the document.
printSpace specifies the color space for
the printer. Valid values are
is, the same as the source); or
RGB
, Working CMYK , Working Gray , Lab
(meaning one of the working color
Color
nothing (that
Working
spaces or Lab color); or a string specifying
a specific colorspace (default is same as
source).
printOneCopy
()
rasterizeAllLayers
()
recordMeasurements
([source]
[, dataPoints])
resizeCanvas
([width]
[, height]
[, anchor])
MeasurementSource
array of string
UnitValue
UnitValue
AnchorPosition
Print one copy of the document.
Rasterizes all layers.
Record measurements of document.
Changes the size of the canvas to display
more or less of the image but does not
change the image size. See resizeImage
.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 95
Method Parameter type Returns What it does (Continued)
resizeImage
([width]
[, height]
[, resolution]
[, resampleMethod]
[, amount])
revealAll
()
rotateCanvas
(angle)
save
()
saveAs
(saveIn
[, options]
[, asCopy]
[, extensionType])
UnitValue
UnitValue
number
ResampleMethod
number
number
File
object (see description)
boolean
Extension
Changes the size of the image.
amount parameter controls the
The
amount of noise value when using
preserve details (Range: 0 - 100).
Expands the document to show clipped
sections.
Rotates the canvas (including the image)
in clockwise direction.
Saves the document.
Saves the document in a specific format.
Specify the save options appropriate to
the format by passing one of these
objects:
BMPSaveOptions
DCS1_SaveOptions
DCS2_SaveOptions
EPSSaveOptions
GIFSaveOptions
JPEGSaveOptions
PDFSaveOptions
PhotoshopSaveOptions
PICTFileSaveOptions
PICTResourceSaveOptions
PixarSaveOptions
PNGSaveOptions
RawSaveOptions
SGIRGBSaveOptions
TargaSaveOptions
TiffSaveOptions
splitChannels
()
suspendHistory
(historyString
javaScriptString)
trap
(width)
string
string
number
array of
Document
Splits the document channels into
separate images.
Provides a single entry in history states for
the entire script provided by
javaScriptString. Allows a single undo
for all actions taken in the script.
historyString parameter provides
The
the string to use for the history state.
javaScriptString parameter
The
provides a string of JavaScript code to
excute while history is suspended.
Applies trapping to a CMYK document.
Valid only when
DocumentMode.CMYK
docRef.mode =
.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 96
Method Parameter type Returns What it does (Continued)
trim
([type]
[, top]
[, left]
[, bottom]
[, right])
TrimType
boolean
boolean
boolean
boolean
image on the specified sides of the canvas.
Default is
true for all Boolean parameters.
Document sample script
The following script creates a document that contains two images (a sunflower and a duck) obtained from
the Adobe Photoshop CC Samples folder and employs the following steps:
● Determines which image is larger.
● Resizes the smaller image to match the larger image.
● Creates a merged document twice as high as either image in order to hold both images.
● Selects part of the document and pastes the sunflower into the selection.
● Inverts the selection and pastes the duck into the lower part of the document.
● Positions the sunflower over the duck.
Document.jsx
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
Trims the transparent area around the
// Set Adobe Photoshop CC to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
// first close all the open documents
while (app.documents.length) {
app.activeDocument.close()
}
// Open the sunflower and duck files from the samples folder
var flowerDoc = open(File(app.path + "/Samples/Sunflower.psd"))
var duckDoc = open(File(app.path + "/Samples/Ducky.tif"))
// Find out which document is larger
// Resize the smaller document the to the larger document’s size
// The resize requires the document be the active/front document
if ((flowerDoc.width.value * flowerDoc.height.value) >
(duckDoc.width.value * duckDoc.height.value)) {
app.activeDocument = duckDoc
duckDoc.resize(flowerDoc.width, flowerDoc.height)
}
else {
app.activeDocument = flowerDoc
flowerDoc.resizeImage(duckDoc.width, duckDoc.height)
}
// Create a new document twice as high as two files
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 97
var mergedDoc = app.documents.add(duckDoc.width, duckDoc.height * 2,
duckDoc.resolution, "FlowerOverDuck")
// Copy the flower to the top; make it the active document so we can manipulate it
app.activeDocument = flowerDoc
flowerDoc.activeLayer.copy()
//Paste the flower to the merged document, making the merged document active
app.activeDocument = mergedDoc
// Select a square area at the top of the new document
var selRegion = Array(Array(0, 0),
Array(mergedDoc.width.value, 0),
Array(mergedDoc.width.value, mergedDoc.height.value / 2),
Array(0, mergedDoc.height.value / 2),
Array(0, 0))
// Create the selection
mergedDoc.selection.select(selRegion)
//Paste in the flower
mergedDoc.paste(TRUE)
// do the same thing for the duck
app.activeDocument = duckDoc
duckDoc.activeLayer.copy()
app.activeDocument = mergedDoc
mergedDoc.selection.select(selRegion)
// Inverting the selection so the bottom of the document is now selected
mergedDoc.selection.invert()
// Paste the duck
mergedDoc.paste(TRUE)
// get rid of our originals without modifying them
duckDoc.close(SaveOptions.DONOTSAVECHANGES)
flowerDoc.close(SaveOptions.DONOTSAVECHANGES)
// Reset the application preferences
app.preferences.rulerUnits = startRulerUnits
app.preferences.typeUnits = startTypeUnits
app.displayDialogs = startDisplayDialogs
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 98
DocumentPrintSettings
The print settings for a document.
Properties
Property Value type What it is
backgroundColor
bleedWidth
caption
centerCropMarks
colorBars
copies
cornerCropMarks
colorHandling
activePrinter
flip
hardProof
interpolate
labels
mapBlack
negative
SolidColor
UnitValue
boolean
boolean
boolean
number
boolean
PrintColorHandling
string
boolean
boolean
boolean
boolean
boolean
boolean
Read-write. Background color of page.
Read-write. Bleed width
Read-write. Print the caption found in FileInfo.
Read-write. Print center crop marks.
Read-write. Print color calibration bars.
Read-write. Number of copies to print.
Read-write. Print corner crop marks.
Read-only. Color handling.
Read-write. The currently active printer.
Read-write. Flip the image horizontally.
Read-write. Print a hard proof.
Read-write.
Read-write. Prints the document title.
Read-write. Map blacks.
Read-write. Invert the image colors.
renderIntent
posX
posY
printBorder
printerName
printSpace
registrationMarks
Intent
UnitValue
UnitValue
UnitValue
string
string
boolean
Read-write. Color conversion intent when print
space is different from the source space.
Read-only. The x position of the image on
page.
Read-only. The y position of the image on
page.
Read-write. The width of the print border.
Read-write. Name of the printer.
Read-write. color space for printer. Can be
nothing (meaning same as source); 'Working
RGB', 'Working CMYK', 'Working Gray', 'Lab
Color' (meaning one of the working spaces or
Lab color); or a string specifying a specific
colorspace (default is same as source)
Read-write. Print registration marks.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 99
Property Value type What it is (Continued)
scale
vectorData
number
boolean
Read-only. Scale of image on page.
Read-write. Include vector data.
Adobe Photoshop CC
JavaScript Scripting Reference JavaScript Object Reference 100
Methods
Method Parameter type Returns What it does
setPagePosition
(docPosition,
posX,
posY,
scale)
DocPositionStyle
Set the position of the image on the page.
UnitValue
UnitValue
number