232
b c ADOBE PHOTOSHOP CS4 JAVASCRIPT SCRIPTING REFERENCE Revision 1

Adobe Photoshop CS4 JavaScript Reference · 2021. 1. 27. · Adobe Photoshop CS4 JavaScript Scripting Reference 16 typename ..... 113 GalleryOptions

  • Upload
    others

  • View
    26

  • Download
    0

Embed Size (px)

Citation preview

  • bbc

    ADOBE PHOTOSHOP CS4

    JAVASCRIPT SCRIPTING REFERENCERevision 1

  • © 2008 Adobe Systems Incorporated. All rights reserved.

    Adobe® Creative Suite® 4 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 ............................................................................................................................... 33JavaScript support in Adobe Photoshop CS4 ....................................................................................................................33

    Executing scripts ....................................................................................................................................................................34Installing scripts ...............................................................................................................................................................34Executing other scripts ..................................................................................................................................................34

    Startup scripts .........................................................................................................................................................................34Object model usage and naming...........................................................................................................................................35Changes since earlier versions - CS4 changes ...................................................................................................................35.............................................................................................................................................................................................................36

    2 JavaScript Object Reference ..................................................................................................... 37Object descriptions......................................................................................................................................................................37

    Properties notation ...............................................................................................................................................................37displayDialogs.................................................................................................................................................................37

    Methods notation ..................................................................................................................................................................37crop.....................................................................................................................................................................................38

    ActionDescriptor ..........................................................................................................................................................................39Properties..................................................................................................................................................................................39

    count ..................................................................................................................................................................................39typename .........................................................................................................................................................................39

    Methods ....................................................................................................................................................................................39clear ....................................................................................................................................................................................39erase ...................................................................................................................................................................................39fromStream......................................................................................................................................................................39getBoolean.......................................................................................................................................................................39getClass .............................................................................................................................................................................39getData..............................................................................................................................................................................39getDouble ........................................................................................................................................................................39getEnumerationType ...................................................................................................................................................39getEnumerationValue..................................................................................................................................................39getInteger.........................................................................................................................................................................39getKey................................................................................................................................................................................39getList ................................................................................................................................................................................40getObjectType................................................................................................................................................................40getObjectValue...............................................................................................................................................................40getPath ..............................................................................................................................................................................40getReference ...................................................................................................................................................................40getString ...........................................................................................................................................................................40getType .............................................................................................................................................................................40getUnitDoubleType ......................................................................................................................................................40getUnitDoubleValue.....................................................................................................................................................40hasKey................................................................................................................................................................................40isEqual................................................................................................................................................................................40putBoolean ......................................................................................................................................................................40putClass.............................................................................................................................................................................40putData .............................................................................................................................................................................40

  • Adobe Photoshop CS4JavaScript Scripting Reference 4

    putDouble ........................................................................................................................................................................40putEnumerated ..............................................................................................................................................................40putInteger ........................................................................................................................................................................40putList ................................................................................................................................................................................41putObject..........................................................................................................................................................................41putPath..............................................................................................................................................................................41putReference...................................................................................................................................................................41putString...........................................................................................................................................................................41putUnitDouble................................................................................................................................................................41toStream ...........................................................................................................................................................................41

    ActionList.........................................................................................................................................................................................42Properties..................................................................................................................................................................................42

    count ..................................................................................................................................................................................42typename .........................................................................................................................................................................42

    Methods ....................................................................................................................................................................................42clear ....................................................................................................................................................................................42getBoolean.......................................................................................................................................................................42getClass .............................................................................................................................................................................42getData..............................................................................................................................................................................42getDouble ........................................................................................................................................................................42getEnumerationType ...................................................................................................................................................42getEnumerationValue..................................................................................................................................................42getInteger.........................................................................................................................................................................42getList ................................................................................................................................................................................43getObjectType................................................................................................................................................................43getObjectValue...............................................................................................................................................................43getPath ..............................................................................................................................................................................43getReference ...................................................................................................................................................................43getString ...........................................................................................................................................................................43getType .............................................................................................................................................................................43getUnitDoubleType ......................................................................................................................................................43getUnitDoubleValue.....................................................................................................................................................43putBoolean ......................................................................................................................................................................43putClass.............................................................................................................................................................................43putData .............................................................................................................................................................................43putDouble ........................................................................................................................................................................43putEnumerated ..............................................................................................................................................................43putInteger ........................................................................................................................................................................43putList ................................................................................................................................................................................43putObject..........................................................................................................................................................................43putPath..............................................................................................................................................................................43putReference...................................................................................................................................................................43putString...........................................................................................................................................................................44putUnitDouble................................................................................................................................................................44

    ActionReference ...........................................................................................................................................................................45Properties..................................................................................................................................................................................45

    typename .........................................................................................................................................................................45Methods ....................................................................................................................................................................................45

    getContainer ...................................................................................................................................................................45getDesiredClass..............................................................................................................................................................45getEnumeratedType.....................................................................................................................................................45

  • Adobe Photoshop CS4JavaScript Scripting Reference 5

    getEnumeratedValue ...................................................................................................................................................45getForm.............................................................................................................................................................................45getIdentifier .....................................................................................................................................................................45getIndex ............................................................................................................................................................................45getName ...........................................................................................................................................................................45getOffset ...........................................................................................................................................................................45getProperty......................................................................................................................................................................45putClass.............................................................................................................................................................................46putEnumerated ..............................................................................................................................................................46putIdentifier.....................................................................................................................................................................46putIndex............................................................................................................................................................................46putName ...........................................................................................................................................................................46putOffset...........................................................................................................................................................................46putProperty......................................................................................................................................................................46

    Application .....................................................................................................................................................................................47Properties..................................................................................................................................................................................47

    activeDocument.............................................................................................................................................................47backgroundColor...........................................................................................................................................................47build....................................................................................................................................................................................47colorSettings ...................................................................................................................................................................47displayDialogs.................................................................................................................................................................47documents .......................................................................................................................................................................47fonts....................................................................................................................................................................................47foregroundColor ............................................................................................................................................................47freeMemory .....................................................................................................................................................................47locale ..................................................................................................................................................................................48macintoshFileTypes ......................................................................................................................................................48measurementLog ..........................................................................................................................................................48name...................................................................................................................................................................................48notifiers .............................................................................................................................................................................48notifiersEnabled .............................................................................................................................................................48path.....................................................................................................................................................................................48playbackDisplayDialogs ..............................................................................................................................................48playbackParameters .....................................................................................................................................................48preferences ......................................................................................................................................................................48preferencesFolder .........................................................................................................................................................48recentFiles ........................................................................................................................................................................48scriptingBuildDate ........................................................................................................................................................48scriptingVersion .............................................................................................................................................................48systemInformation........................................................................................................................................................48typename .........................................................................................................................................................................48version ...............................................................................................................................................................................49windowsFileTypes.........................................................................................................................................................49

    Methods ....................................................................................................................................................................................49batch ..................................................................................................................................................................................49beep....................................................................................................................................................................................49bringToFront ...................................................................................................................................................................49charIDToTypeID..............................................................................................................................................................49doAction ...........................................................................................................................................................................49eraseCustomOptions....................................................................................................................................................49executeAction.................................................................................................................................................................49

  • Adobe Photoshop CS4JavaScript Scripting Reference 6

    executeActionGet..........................................................................................................................................................49featureEnabled ...............................................................................................................................................................49getCustomOptions........................................................................................................................................................50load .....................................................................................................................................................................................50makeContactSheet........................................................................................................................................................50makePDFPresentation .................................................................................................................................................50makePhotoGallery.........................................................................................................................................................50makePhotomerge..........................................................................................................................................................50makePicturePackage....................................................................................................................................................50open ...................................................................................................................................................................................51openDialog ......................................................................................................................................................................51purge..................................................................................................................................................................................51putCustomOptions .......................................................................................................................................................51refresh ................................................................................................................................................................................51runMenuItem ..................................................................................................................................................................51stringIDToTypeID...........................................................................................................................................................51togglePalettes.................................................................................................................................................................52typeIDToCharID..............................................................................................................................................................52typeIDToStringID ...........................................................................................................................................................52

    ArtLayer............................................................................................................................................................................................54Properties..................................................................................................................................................................................54

    allLocked...........................................................................................................................................................................54blendMode.......................................................................................................................................................................54bounds...............................................................................................................................................................................54fillOpacity..........................................................................................................................................................................54filterMaskDensity ...........................................................................................................................................................54filterMaskFeather...........................................................................................................................................................54grouped ............................................................................................................................................................................54isBackgroundLayer........................................................................................................................................................54kind .....................................................................................................................................................................................54layerMaskDensity...........................................................................................................................................................54layerMaskFeather ..........................................................................................................................................................55linkedLayers.....................................................................................................................................................................55name...................................................................................................................................................................................55opacity ...............................................................................................................................................................................55parent.................................................................................................................................................................................55pixelsLocked....................................................................................................................................................................55positionLocked...............................................................................................................................................................55textItem.............................................................................................................................................................................55transparentPixelsLocked.............................................................................................................................................55typename .........................................................................................................................................................................55vectorMaskDensity........................................................................................................................................................55vectorMaskFeather .......................................................................................................................................................55visible .................................................................................................................................................................................55xmpMetadata..................................................................................................................................................................55

    Methods ....................................................................................................................................................................................56adjustBrightnessContrast ...........................................................................................................................................56adjustColorBalance .......................................................................................................................................................56adjustCurves....................................................................................................................................................................56adjustLevels .....................................................................................................................................................................56applyAddNoise ...............................................................................................................................................................56

  • Adobe Photoshop CS4JavaScript Scripting Reference 7

    applyAverage..................................................................................................................................................................56applyBlur...........................................................................................................................................................................56applyBlurMore ................................................................................................................................................................56applyClouds.....................................................................................................................................................................56applyCustomFilter.........................................................................................................................................................56applyDeInterlace............................................................................................................................................................57applyDespeckle ..............................................................................................................................................................57applyDifferenceClouds................................................................................................................................................57applyDiffuseGlow ..........................................................................................................................................................57applyDisplace..................................................................................................................................................................57applyDustAndScratches..............................................................................................................................................57applyGaussianBlur.........................................................................................................................................................57applyGlassEffect .............................................................................................................................................................57applyHighPass ................................................................................................................................................................57applyLensBlur .................................................................................................................................................................58applyLensFlare................................................................................................................................................................58applyMaximum ..............................................................................................................................................................58applyMedianNoise ........................................................................................................................................................58applyMinimum ...............................................................................................................................................................59applyMotionBlur ............................................................................................................................................................59applyNTSC........................................................................................................................................................................59applyOceanRipple .........................................................................................................................................................59applyOffset.......................................................................................................................................................................59applyPinch .......................................................................................................................................................................59applyPolarCoordinates ................................................................................................................................................59applyRadialBlur ..............................................................................................................................................................59applyRipple......................................................................................................................................................................59applySharpen..................................................................................................................................................................59applySharpenEdges......................................................................................................................................................59applySharpenMore .......................................................................................................................................................59applyShear .......................................................................................................................................................................59applySmartBlur...............................................................................................................................................................60applySpherize .................................................................................................................................................................60applyStyle.........................................................................................................................................................................60applyTextureFill..............................................................................................................................................................60applyTwirl .........................................................................................................................................................................60applyUnSharpMask.......................................................................................................................................................60applyWave........................................................................................................................................................................60applyZigZag.....................................................................................................................................................................60autoContrast....................................................................................................................................................................60autoLevels ........................................................................................................................................................................60clear ....................................................................................................................................................................................60copy ....................................................................................................................................................................................61cut........................................................................................................................................................................................61desaturate ........................................................................................................................................................................61duplicate ...........................................................................................................................................................................61equalize .............................................................................................................................................................................61invert ..................................................................................................................................................................................61link.......................................................................................................................................................................................61merge.................................................................................................................................................................................61mixChannels....................................................................................................................................................................62

  • Adobe Photoshop CS4JavaScript Scripting Reference 8

    move...................................................................................................................................................................................62photoFilter .......................................................................................................................................................................62posterize ...........................................................................................................................................................................62rasterize.............................................................................................................................................................................62remove...............................................................................................................................................................................62resize ..................................................................................................................................................................................63rotate..................................................................................................................................................................................63selectiveColor..................................................................................................................................................................63shadowHighlight ...........................................................................................................................................................63threshold...........................................................................................................................................................................63translate ............................................................................................................................................................................63unlink .................................................................................................................................................................................63

    ArtLayers..........................................................................................................................................................................................66Properties..................................................................................................................................................................................66

    length.................................................................................................................................................................................66parent.................................................................................................................................................................................66typename .........................................................................................................................................................................66

    Methods ....................................................................................................................................................................................66add ......................................................................................................................................................................................66getByName ......................................................................................................................................................................66removeAll .........................................................................................................................................................................66

    BatchOptions .................................................................................................................................................................................67Properties..................................................................................................................................................................................67

    destination .......................................................................................................................................................................67destinationFolder ..........................................................................................................................................................67errorFile .............................................................................................................................................................................67fileNaming........................................................................................................................................................................67macintoshCompatible .................................................................................................................................................67overrideOpen..................................................................................................................................................................67overrideSave....................................................................................................................................................................67startingSerial ...................................................................................................................................................................67suppressOpen.................................................................................................................................................................67suppressProfile ...............................................................................................................................................................68typename .........................................................................................................................................................................68unixCompatible..............................................................................................................................................................68windowsCompatible ....................................................................................................................................................68

    BitmapConversionOptions .......................................................................................................................................................69Properties..................................................................................................................................................................................69

    angle...................................................................................................................................................................................69frequency..........................................................................................................................................................................69method..............................................................................................................................................................................69patternName ...................................................................................................................................................................69resolution..........................................................................................................................................................................69shape..................................................................................................................................................................................69typename .........................................................................................................................................................................69

    BMPSaveOptions ..........................................................................................................................................................................70Properties..................................................................................................................................................................................70

    alphaChannels ................................................................................................................................................................70depth..................................................................................................................................................................................70flipRowOrder ...................................................................................................................................................................70osType................................................................................................................................................................................70

  • Adobe Photoshop CS4JavaScript Scripting Reference 9

    rleCompression ..............................................................................................................................................................70typename .........................................................................................................................................................................70

    CameraRAWOpenOptions ........................................................................................................................................................71Properties..................................................................................................................................................................................71

    bitsPerChannel ...............................................................................................................................................................71blueHue.............................................................................................................................................................................71blueSaturation ................................................................................................................................................................71brightness.........................................................................................................................................................................71chromaticAberrationBY...............................................................................................................................................71chromaticAberrationRC...............................................................................................................................................71colorNoiseReduction....................................................................................................................................................71colorSpace........................................................................................................................................................................71contrast .............................................................................................................................................................................71exposure ...........................................................................................................................................................................71greenHue..........................................................................................................................................................................71greenSaturation .............................................................................................................................................................71luminanceSmoothing ..................................................................................................................................................71redHue ...............................................................................................................................................................................71redSaturation ..................................................................................................................................................................71resolution..........................................................................................................................................................................71saturation .........................................................................................................................................................................71settings ..............................................................................................................................................................................71shadows ............................................................................................................................................................................71shadowTint ......................................................................................................................................................................71sharpness..........................................................................................................................................................................71size ......................................................................................................................................................................................71temperature.....................................................................................................................................................................71tint .......................................................................................................................................................................................72typename .........................................................................................................................................................................72vignettingAmount ........................................................................................................................................................72vignettingMidpoint ......................................................................................................................................................72whiteBalance...................................................................................................................................................................72

    Channel ............................................................................................................................................................................................73Properties..................................................................................................................................................................................73

    color....................................................................................................................................................................................73histogram .........................................................................................................................................................................73kind .....................................................................................................................................................................................73name...................................................................................................................................................................................73opacity ...............................................................................................................................................................................73parent.................................................................................................................................................................................73typename .........................................................................................................................................................................73visible .................................................................................................................................................................................73

    Methods ....................................................................................................................................................................................73duplicate ...........................................................................................................................................................................73merge.................................................................................................................................................................................74remove...............................................................................................................................................................................74

    Channels ..........................................................................................................................................................................................75Properties..................................................................................................................................................................................75

    length.................................................................................................................................................................................75parent.................................................................................................................................................................................75typename .........................................................................................................................................................................75

  • Adobe Photoshop CS4JavaScript Scripting Reference 10

    Methods ....................................................................................................................................................................................75add ......................................................................................................................................................................................75getByName ......................................................................................................................................................................75removeAll .........................................................................................................................................................................75

    CMYKColor......................................................................................................................................................................................80Properties..................................................................................................................................................................................80

    black ...................................................................................................................................................................................80cyan.....................................................................................................................................................................................80magenta............................................................................................................................................................................80typename .........................................................................................................................................................................80yellow.................................................................................................................................................................................80

    ColorSampler .................................................................................................................................................................................81Properties..................................................................................................................................................................................81

    color....................................................................................................................................................................................81position .............................................................................................................................................................................81parent.................................................................................................................................................................................81typename .........................................................................................................................................................................81

    Methods ....................................................................................................................................................................................81move...................................................................................................................................................................................81remove...............................................................................................................................................................................81

    ColorSamplers ...............................................................................................................................................................................82Properties..................................................................................................................................................................................82

    length.................................................................................................................................................................................82parent.................................................................................................................................................................................82typename .........................................................................................................................................................................82

    Methods ....................................................................................................................................................................................82add ......................................................................................................................................................................................82removeAll .........................................................................................................................................................................82

    ContactSheetOptions .................................................................................................................................................................83Properties..................................................................................................................................................................................83

    acrossFirst.........................................................................................................................................................................83bestFit ................................................................................................................................................................................83caption...............................................................................................................................................................................83columnCount ..................................................................................................................................................................83flatten.................................................................................................................................................................................83font......................................................................................................................................................................................83fontSize..............................................................................................................................................................................83height.................................................................................................................................................................................83horizontal .........................................................................................................................................................................83mode ..................................................................................................................................................................................83resolution..........................................................................................................................................................................83rowCount..........................................................................................................................................................................83typename .........................................................................................................................................................................83useAutoSpacing.............................................................................................................................................................83vertical ...............................................................................................................................................................................83width ..................................................................................................................................................................................83

    CountItem .......................................................................................................................................................................................84Properties..................................................................................................................................................................................84

    position .............................................................................................................................................................................84parent.................................................................................................................................................................................84typename .........................................................................................................................................................................84

  • Adobe Photoshop CS4JavaScript Scripting Reference 11

    Methods ....................................................................................................................................................................................84remove...............................................................................................................................................................................84

    CountItems .....................................................................................................................................................................................85Properties..................................................................................................................................................................................85

    length.................................................................................................................................................................................85parent.................................................................................................................................................................................85typename .........................................................................................................................................................................85

    Methods ....................................................................................................................................................................................85add ......................................................................................................................................................................................85getByName ......................................................................................................................................................................85removeAll .........................................................................................................................................................................85

    DCS1_SaveOptions......................................................................................................................................................................86Properties..................................................................................................................................................................................86

    dCS ......................................................................................................................................................................................86embedColorProfile ........................................................................................................................................................86encoding...........................................................................................................................................................................86halftoneScreen ...............................................................................................................................................................86interpolation....................................................................................................................................................................86preview..............................................................................................................................................................................86transferFunction.............................................................................................................................................................86typename .........................................................................................................................................................................86vectorData........................................................................................................................................................................86

    DCS2_SaveOptions......................................................................................................................................................................87Properties..................................................................................................................................................................................87

    dCS ......................................................................................................................................................................................87embedColorProfile ........................................................................................................................................................87encoding...........................................................................................................................................................................87halftoneScreen ...............................................................................................................................................................87interpolation....................................................................................................................................................................87multiFileDCS....................................................................................................................................................................87preview..............................................................................................................................................................................87spotColors ........................................................................................................................................................................87transferFunction.............................................................................................................................................................87typename .........................................................................................................................................................................87vectorData........................................................................................................................................................................87

    DICOMOpenOptions ...................................................................................................................................................................88Properties..................................................................................................................................................................................88

    anonymize........................................................................................................................................................................88columns.............................................................................................................................................................................88reverse ...............................................................................................................................................................................88rows ....................................................................................................................................................................................88showOverlays..................................................................................................................................................................88typename .........................................................................................................................................................................88windowLevel ...................................................................................................................................................................88windowWidth .................................................................................................................................................................88

    Document .......................................................................................................................................................................................89Properties..................................................................................................................................................................................89

    activeChannels ...............................................................................................................................................................89activeHistoryBrushSource ..........................................................................................................................................89activeHistoryState .........................................................................................................................................................89activeLayer .......................................................................................................................................................................89

  • Adobe Photoshop CS4JavaScript Scripting Reference 12

    artLayers............................................................................................................................................................................89backgroundLayer...........................................................................................................................................................89bitsPerChannel ...............................................................................................................................................................89channels ............................................................................................................................................................................89colorProfileName...........................................................................................................................................................89colorProfileType .............................................................................................................................................................89colorSamplers .................................................................................................................................................................89componentChannels....................................................................................................................................................89countItems .......................................................................................................................................................................90fullName............................................................................................................................................................................90height.................................................................................................................................................................................90histogram .........................................................................................................................................................................90historyStates....................................................................................................................................................................90info ......................................................................................................................................................................................90layerComps ......................................................................................................................................................................90layers ..................................................................................................................................................................................90layerSets............................................................................................................................................................................90managed...........................................................................................................................................................................90measurementScale .......................................................................................................................................................90mode ..................................................................................................................................................................................90name..........................................................................................