adobe photoshop cs6 javascript reference€¦ · apple®, mac os ®, and macintosh ® ... adobe...
Embed Size (px)
TRANSCRIPT
-
bbc
ADOBE PHOTOSHOP CS6
JAVASCRIPT SCRIPTING REFERENCE
-
© 2012 Adobe Systems Incorporated. All rights reserved.
Adobe® Creative Suite® 6 Photoshop® JavaScript Scripting Reference for Windows® and Macintosh®.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written consent of Adobe Systems Incorporated. The software described in this document is furnished under license and may only be used or copied in accordance with the terms of such license.
This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights.
Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual organization.
Adobe®, the Adobe logo, Acrobat®, GoLive®,InDesign®, Illustrator®, Photoshop® are either registered trademarks or trademarks of Adobe Systems Incorporated 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 Systems Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that may appear in the informational content contained in this guide.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
-
3
Contents
1 Introduction ............................................................................................................................... 32JavaScript support in Adobe Photoshop CS6 ....................................................................................................................32
Executing scripts ....................................................................................................................................................................33Installing scripts ...............................................................................................................................................................33Executing other scripts ..................................................................................................................................................33
Startup scripts .........................................................................................................................................................................33Object model usage and naming...........................................................................................................................................34Changes since earlier versions—CS6 changes ..................................................................................................................34
2 JavaScript Object Reference ..................................................................................................... 35Object descriptions......................................................................................................................................................................35
Properties notation ...............................................................................................................................................................35displayDialogs.................................................................................................................................................................35
Methods notation ..................................................................................................................................................................35crop.....................................................................................................................................................................................36
ActionDescriptor ..........................................................................................................................................................................37Properties..................................................................................................................................................................................37
count ..................................................................................................................................................................................37typename .........................................................................................................................................................................37
Methods ....................................................................................................................................................................................37clear ....................................................................................................................................................................................37erase ...................................................................................................................................................................................37fromStream......................................................................................................................................................................37getBoolean.......................................................................................................................................................................37getClass .............................................................................................................................................................................37getData..............................................................................................................................................................................37getDouble ........................................................................................................................................................................37getEnumerationType ...................................................................................................................................................37getEnumerationValue..................................................................................................................................................37getInteger.........................................................................................................................................................................37getKey................................................................................................................................................................................37getLargeInteger .............................................................................................................................................................38getList ................................................................................................................................................................................38getObjectType................................................................................................................................................................38getObjectValue...............................................................................................................................................................38getPath ..............................................................................................................................................................................38getReference ...................................................................................................................................................................38getString ...........................................................................................................................................................................38getType .............................................................................................................................................................................38getUnitDoubleType......................................................................................................................................................38getUnitDoubleValue.....................................................................................................................................................38hasKey................................................................................................................................................................................38isEqual................................................................................................................................................................................38putBoolean ......................................................................................................................................................................38putClass.............................................................................................................................................................................38putData .............................................................................................................................................................................38
-
Adobe Photoshop CS6JavaScript Scripting Reference 4
putDouble ........................................................................................................................................................................38putEnumerated ..............................................................................................................................................................38putInteger ........................................................................................................................................................................39putLargeInteger .............................................................................................................................................................39putList ................................................................................................................................................................................39putObject..........................................................................................................................................................................39putPath..............................................................................................................................................................................39putReference...................................................................................................................................................................39putString...........................................................................................................................................................................39putUnitDouble................................................................................................................................................................39toStream ...........................................................................................................................................................................39
ActionList.........................................................................................................................................................................................40Properties..................................................................................................................................................................................40
count ..................................................................................................................................................................................40typename .........................................................................................................................................................................40
Methods ....................................................................................................................................................................................40clear ....................................................................................................................................................................................40getBoolean.......................................................................................................................................................................40getClass .............................................................................................................................................................................40getData..............................................................................................................................................................................40getDouble ........................................................................................................................................................................40getEnumerationType ...................................................................................................................................................40getEnumerationValue..................................................................................................................................................40getInteger.........................................................................................................................................................................40getLargeInteger .............................................................................................................................................................41getList ................................................................................................................................................................................41getObjectType................................................................................................................................................................41getObjectValue...............................................................................................................................................................41getPath ..............................................................................................................................................................................41getReference ...................................................................................................................................................................41getString ...........................................................................................................................................................................41getType .............................................................................................................................................................................41getUnitDoubleType......................................................................................................................................................41getUnitDoubleValue.....................................................................................................................................................41putBoolean ......................................................................................................................................................................41putClass.............................................................................................................................................................................41putData .............................................................................................................................................................................41putDouble ........................................................................................................................................................................41putEnumerated ..............................................................................................................................................................41putInteger ........................................................................................................................................................................41putLargeInteger .............................................................................................................................................................41putList ................................................................................................................................................................................41putObject..........................................................................................................................................................................42putPath..............................................................................................................................................................................42putReference...................................................................................................................................................................42putString...........................................................................................................................................................................42putUnitDouble................................................................................................................................................................42
ActionReference ...........................................................................................................................................................................43Properties..................................................................................................................................................................................43
typename .........................................................................................................................................................................43Methods ....................................................................................................................................................................................43
-
Adobe Photoshop CS6JavaScript Scripting Reference 5
getContainer ...................................................................................................................................................................43getDesiredClass..............................................................................................................................................................43getEnumeratedType.....................................................................................................................................................43getEnumeratedValue ...................................................................................................................................................43getForm.............................................................................................................................................................................43getIdentifier .....................................................................................................................................................................43getIndex............................................................................................................................................................................43getName ...........................................................................................................................................................................43getOffset ...........................................................................................................................................................................43getProperty......................................................................................................................................................................43putClass.............................................................................................................................................................................44putEnumerated ..............................................................................................................................................................44putIdentifier.....................................................................................................................................................................44putIndex............................................................................................................................................................................44putName...........................................................................................................................................................................44putOffset...........................................................................................................................................................................44putProperty......................................................................................................................................................................44
Application .....................................................................................................................................................................................45Properties..................................................................................................................................................................................45
activeDocument.............................................................................................................................................................45backgroundColor...........................................................................................................................................................45build....................................................................................................................................................................................45colorSettings ...................................................................................................................................................................45displayDialogs.................................................................................................................................................................45documents .......................................................................................................................................................................45fonts....................................................................................................................................................................................45foregroundColor ............................................................................................................................................................45freeMemory .....................................................................................................................................................................45locale ..................................................................................................................................................................................46macintoshFileTypes......................................................................................................................................................46measurementLog ..........................................................................................................................................................46name...................................................................................................................................................................................46notifiers .............................................................................................................................................................................46notifiersEnabled.............................................................................................................................................................46path.....................................................................................................................................................................................46playbackDisplayDialogs ..............................................................................................................................................46playbackParameters .....................................................................................................................................................46preferences ......................................................................................................................................................................46preferencesFolder .........................................................................................................................................................46recentFiles ........................................................................................................................................................................46scriptingBuildDate ........................................................................................................................................................46scriptingVersion .............................................................................................................................................................46systemInformation........................................................................................................................................................46typename .........................................................................................................................................................................46version ...............................................................................................................................................................................47windowsFileTypes.........................................................................................................................................................47
Methods ....................................................................................................................................................................................47batch ..................................................................................................................................................................................47beep....................................................................................................................................................................................47bringToFront ...................................................................................................................................................................47charIDToTypeID..............................................................................................................................................................47
-
Adobe Photoshop CS6JavaScript Scripting Reference 6
doAction ...........................................................................................................................................................................47eraseCustomOptions....................................................................................................................................................47executeAction.................................................................................................................................................................47executeActionGet..........................................................................................................................................................47featureEnabled ...............................................................................................................................................................47getCustomOptions........................................................................................................................................................48isQuicktimeAvailable....................................................................................................................................................48load .....................................................................................................................................................................................48makeContactSheet........................................................................................................................................................48makePDFPresentation .................................................................................................................................................48makePhotoGallery.........................................................................................................................................................48makePhotomerge..........................................................................................................................................................48makePicturePackage....................................................................................................................................................48open ...................................................................................................................................................................................49openDialog ......................................................................................................................................................................49purge..................................................................................................................................................................................49putCustomOptions .......................................................................................................................................................49refresh................................................................................................................................................................................49refreshFonts.....................................................................................................................................................................49runMenuItem ..................................................................................................................................................................49showColorPicker ............................................................................................................................................................50stringIDToTypeID...........................................................................................................................................................50togglePalettes.................................................................................................................................................................50typeIDToCharID..............................................................................................................................................................50typeIDToStringID ...........................................................................................................................................................50
ArtLayer............................................................................................................................................................................................53Properties..................................................................................................................................................................................53
allLocked...........................................................................................................................................................................53blendMode.......................................................................................................................................................................53bounds...............................................................................................................................................................................53fillOpacity..........................................................................................................................................................................53filterMaskDensity ...........................................................................................................................................................53filterMaskFeather...........................................................................................................................................................53grouped ............................................................................................................................................................................53isBackgroundLayer........................................................................................................................................................53kind .....................................................................................................................................................................................53layerMaskDensity...........................................................................................................................................................53layerMaskFeather ..........................................................................................................................................................54linkedLayers.....................................................................................................................................................................54name...................................................................................................................................................................................54opacity ...............................................................................................................................................................................54parent.................................................................................................................................................................................54pixelsLocked....................................................................................................................................................................54positionLocked...............................................................................................................................................................54textItem.............................................................................................................................................................................54transparentPixelsLocked.............................................................................................................................................54typename .........................................................................................................................................................................54vectorMaskDensity........................................................................................................................................................54vectorMaskFeather .......................................................................................................................................................54visible .................................................................................................................................................................................54xmpMetadata..................................................................................................................................................................54
-
Adobe Photoshop CS6JavaScript Scripting Reference 7
Methods ....................................................................................................................................................................................55adjustBrightnessContrast ...........................................................................................................................................55adjustColorBalance .......................................................................................................................................................55adjustCurves....................................................................................................................................................................55adjustLevels .....................................................................................................................................................................55applyAddNoise ...............................................................................................................................................................55applyAverage..................................................................................................................................................................55applyBlur...........................................................................................................................................................................55applyBlurMore ................................................................................................................................................................55applyClouds.....................................................................................................................................................................55applyCustomFilter.........................................................................................................................................................55applyDeInterlace............................................................................................................................................................56applyDespeckle ..............................................................................................................................................................56applyDifferenceClouds................................................................................................................................................56applyDiffuseGlow ..........................................................................................................................................................56applyDisplace..................................................................................................................................................................56applyDustAndScratches..............................................................................................................................................56applyGaussianBlur.........................................................................................................................................................56applyGlassEffect.............................................................................................................................................................56applyHighPass ................................................................................................................................................................56applyLensBlur .................................................................................................................................................................57applyLensFlare................................................................................................................................................................57applyMaximum ..............................................................................................................................................................57applyMedianNoise ........................................................................................................................................................57applyMinimum ...............................................................................................................................................................58applyMotionBlur ............................................................................................................................................................58applyNTSC........................................................................................................................................................................58applyOceanRipple .........................................................................................................................................................58applyOffset.......................................................................................................................................................................58applyPinch .......................................................................................................................................................................58applyPolarCoordinates ................................................................................................................................................58applyRadialBlur ..............................................................................................................................................................58applyRipple......................................................................................................................................................................58applySharpen..................................................................................................................................................................58applySharpenEdges......................................................................................................................................................58applySharpenMore .......................................................................................................................................................58applyShear .......................................................................................................................................................................58applySmartBlur...............................................................................................................................................................59applySpherize .................................................................................................................................................................59applyStyle.........................................................................................................................................................................59applyTextureFill..............................................................................................................................................................59applyTwirl .........................................................................................................................................................................59applyUnSharpMask.......................................................................................................................................................59applyWave........................................................................................................................................................................59applyZigZag.....................................................................................................................................................................59autoContrast....................................................................................................................................................................59autoLevels ........................................................................................................................................................................59clear ....................................................................................................................................................................................59copy ....................................................................................................................................................................................60cut........................................................................................................................................................................................60desaturate ........................................................................................................................................................................60
-
Adobe Photoshop CS6JavaScript Scripting Reference 8
duplicate ...........................................................................................................................................................................60equalize .............................................................................................................................................................................60invert ..................................................................................................................................................................................60link.......................................................................................................................................................................................60merge.................................................................................................................................................................................60mixChannels....................................................................................................................................................................61move...................................................................................................................................................................................61photoFilter .......................................................................................................................................................................61posterize ...........................................................................................................................................................................61rasterize.............................................................................................................................................................................61remove...............................................................................................................................................................................61resize ..................................................................................................................................................................................62rotate..................................................................................................................................................................................62selectiveColor..................................................................................................................................................................62shadowHighlight ...........................................................................................................................................................62threshold...........................................................................................................................................................................62translate ............................................................................................................................................................................62unlink .................................................................................................................................................................................62
ArtLayers..........................................................................................................................................................................................65Properties..................................................................................................................................................................................65
length.................................................................................................................................................................................65parent.................................................................................................................................................................................65typename .........................................................................................................................................................................65
Methods ....................................................................................................................................................................................65add ......................................................................................................................................................................................65getByName ......................................................................................................................................................................65removeAll .........................................................................................................................................................................65
BatchOptions .................................................................................................................................................................................66Properties..................................................................................................................................................................................66
destination .......................................................................................................................................................................66destinationFolder ..........................................................................................................................................................66errorFile .............................................................................................................................................................................66fileNaming........................................................................................................................................................................66macintoshCompatible .................................................................................................................................................66overrideOpen..................................................................................................................................................................66overrideSave....................................................................................................................................................................66startingSerial ...................................................................................................................................................................66suppressOpen.................................................................................................................................................................66suppressProfile ...............................................................................................................................................................67typename .........................................................................................................................................................................67unixCompatible..............................................................................................................................................................67windowsCompatible ....................................................................................................................................................67
BitmapConversionOptions .......................................................................................................................................................68Properties..................................................................................................................................................................................68
angle...................................................................................................................................................................................68frequency..........................................................................................................................................................................68method..............................................................................................................................................................................68patternName...................................................................................................................................................................68resolution..........................................................................................................................................................................68shape..................................................................................................................................................................................68typename .........................................................................................................................................................................68
-
Adobe Photoshop CS6JavaScript Scripting Reference 9
BMPSaveOptions ..........................................................................................................................................................................69Properties..................................................................................................................................................................................69
alphaChannels ................................................................................................................................................................69depth..................................................................................................................................................................................69flipRowOrder ...................................................................................................................................................................69osType................................................................................................................................................................................69rleCompression ..............................................................................................................................................................69typename .........................................................................................................................................................................69
CameraRAWOpenOptions ........................................................................................................................................................70Properties..................................................................................................................................................................................70
bitsPerChannel ...............................................................................................................................................................70blueHue.............................................................................................................................................................................70blueSaturation ................................................................................................................................................................70brightness.........................................................................................................................................................................70chromaticAberrationBY...............................................................................................................................................70chromaticAberrationRC...............................................................................................................................................70colorNoiseReduction....................................................................................................................................................70colorSpace........................................................................................................................................................................70contrast .............................................................................................................................................................................70exposure ...........................................................................................................................................................................70greenHue..........................................................................................................................................................................70greenSaturation .............................................................................................................................................................70luminanceSmoothing ..................................................................................................................................................70redHue...............................................................................................................................................................................70redSaturation ..................................................................................................................................................................70resolution..........................................................................................................................................................................70saturation .........................................................................................................................................................................70settings..............................................................................................................................................................................70shadows ............................................................................................................................................................................70shadowTint ......................................................................................................................................................................70sharpness..........................................................................................................................................................................70size ......................................................................................................................................................................................70temperature.....................................................................................................................................................................70tint.......................................................................................................................................................................................71typename .........................................................................................................................................................................71vignettingAmount ........................................................................................................................................................71vignettingMidpoint ......................................................................................................................................................71whiteBalance...................................................................................................................................................................71
Channel ............................................................................................................................................................................................72Properties..................................................................................................................................................................................72
color....................................................................................................................................................................................72histogram .........................................................................................................................................................................72kind .....................................................................................................................................................................................72name...................................................................................................................................................................................72opacity ...............................................................................................................................................................................72parent.................................................................................................................................................................................72typename .........................................................................................................................................................................72visible .................................................................................................................................................................................72
Methods ....................................................................................................................................................................................72duplicate ...........................................................................................................................................................................72merge.................................................................................................................................................................................73
-
Adobe Photoshop CS6JavaScript Scripting Reference 10
remove...............................................................................................................................................................................73Channels ..........................................................................................................................................................................................74
Properties..................................................................................................................................................................................74length.................................................................................................................................................................................74parent.................................................................................................................................................................................74typename .........................................................................................................................................................................74
Methods ....................................................................................................................................................................................74add ......................................................................................................................................................................................74getByName ......................................................................................................................................................................74removeAll .........................................................................................................................................................................74
CMYKColor......................................................................................................................................................................................79Properties..................................................................................................................................................................................79
black ...................................................................................................................................................................................79cyan.....................................................................................................................................................................................79magenta............................................................................................................................................................................79typename .........................................................................................................................................................................79yellow.................................................................................................................................................................................79
ColorSampler .................................................................................................................................................................................80Properties..................................................................................................................................................................................80
color....................................................................................................................................................................................80position .............................................................................................................................................................................80parent.................................................................................................................................................................................80typename .........................................................................................................................................................................80
Methods ....................................................................................................................................................................................80move...................................................................................................................................................................................80remove...............................................................................................................................................................................80
ColorSamplers ...............................................................................................................................................................................81Properties..................................................................................................................................................................................81
length.................................................................................................................................................................................81parent.................................................................................................................................................................................81typename .........................................................................................................................................................................81
Methods ....................................................................................................................................................................................81add ......................................................................................................................................................................................81removeAll .........................................................................................................................................................................81
ContactSheetOptions .................................................................................................................................................................82Properties..................................................................................................................................................................................82
acrossFirst.........................................................................................................................................................................82bestFit ................................................................................................................................................................................82caption...............................................................................................................................................................................82columnCount ..................................................................................................................................................................82flatten.................................................................................................................................................................................82font......................................................................................................................................................................................82fontSize..............................................................................................................................................................................82height.................................................................................................................................................................................82horizontal .........................................................................................................................................................................82mode ..................................................................................................................................................................................82resolution..........................................................................................................................................................................82rowCount..........................................................................................................................................................................82typename .........................................................................................................................................................................82useAutoSpacing.............................................................................................................................................................82vertical ...............................................................................................................................................................................82
-
Adobe Photoshop CS6JavaScript Scripting Reference 11
width ..................................................................................................................................................................................82CountItem .......................................................................................................................................................................................83
Properties..................................................................................................................................................................................83position .............................................................................................................................................................................83parent.................................................................................................................................................................................83typename .........................................................................................................................................................................83
Methods ....................................................................................................................................................................................83remove...............................................................................................................................................................................83
CountItems .....................................................................................................................................................................................84Properties..................................................................................................................................................................................84
length.................................................................................................................................................................................84parent.................................................................................................................................................................................84typename .........................................................................................................................................................................84
Methods ....................................................................................................................................................................................84add ......................................................................................................................................................................................84getByName ......................................................................................................................................................................84removeAll .........................................................................................................................................................................84
DCS1_SaveOptions......................................................................................................................................................................85Properties..................................................................................................................................................................................85
dCS ......................................................................................................................................................................................85embedColorProfile........................................................................................................................................................85encoding...........................................................................................................................................................................85halftoneScreen ...............................................................................................................................................................85interpolation....................................................................................................................................................................85preview..............................................................................................................................................................................85transferFunction.............................................................................................................................................................85typename .........................................................................................................................................................................85vectorData........................................................................................................................................................................85
DCS2_SaveOptions......................................................................................................................................................................86Properties..................................................................................................................................................................................86
dCS ......................................................................................................................................................................................86embedColorProfile........................................................................................................................................................86encoding...........................................................................................................................................................................86halftoneScreen ...............................................................................................................................................................86interpolation....................................................................................................................................................................86multiFileDCS....................................................................................................................................................................86preview..............................................................................................................................................................................86spotColors ........................................................................................................................................................................86transferFunction.............................................................................................................................................................86typename .........................................................................................................................................................................86vectorData........................................................................................................................................................................86
DICOMOpenOptions ...................................................................................................................................................................87Properties..................................................................................................................................................................................87
anonymize........................................................................................................................................................................87columns.............................................................................................................................................................................87reverse ...............................................................................................................................................................................87rows ....................................................................................................................................................................................87showOverlays..................................................................................................................................................................87typename .........................................................................................................................................................................87windowLevel ...................................................................................................................................................................87windowWidth .................................................................................................................................................................87
-
Adobe Photoshop CS6JavaScript Scripting Reference 12
Document .......................................................................................................................................................................................88Properties..................................................................................................................................................................................88
activeChannels ...............................................................................................................................................................88activeHistoryBrushSource ..........................................................................................................................................88activeHistoryState .........................................................................................................................................................88activeLayer .......................................................................................................................................................................88artLayers............................................................................................................................................................................88backgroundLayer...........................................................................................................................................................88bitsPerChannel ...............................................................................................................................................................88channels............................................................................................................................................................................88colorProfileName...........................................................................................................................................................88colorProfileType.............................................................................................................................................................88colorSamplers .................................................................................................................................................................88componentChannels....................................................................................................................................................88countItems .......................................................................................................................................................................89fullName............................................................................................................................................................................89guides ................................................................................................................................................................................89height.................................................................................................................................................................................89histogram .........................................................................................................................................................................89historyStates....................................................................................................................................................................89info ......................................................................................................................................................................................89layerComps .....................