ADOBE PHOTOSHOP CS6 JAVASCRIPT SCRIPTING REFERENCE bc
© 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.
Contents 1 Introduction ............................................................................................................................... 32 JavaScript support in Adobe Photoshop CS6 ....................................................................................................................32 Executing scripts ....................................................................................................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 4 putDouble ........................................................................................................................................................................38 putEnumerated ..............................................................................................................................................................38 putInteger ..........................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 5 getContainer ...................................................................................................................................................................43 getDesiredClass..............................................................................................................................................................43 getEnumeratedType.....................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 6 doAction ...........................................................................................................................................................................47 eraseCustomOptions....................................................................................................................................................47 executeAction............................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 7 Methods ....................................................................................................................................................................................55 adjustBrightnessContrast ...........................................................................................................................................55 adjustColorBalance ................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 8 duplicate ...........................................................................................................................................................................60 equalize .............................................................................................................................................................................60 invert .................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 9 BMPSaveOptions ..........................................................................................................................................................................69 Properties..................................................................................................................................................................................69 alphaChannels ................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 10 remove...............................................................................................................................................................................73 Channels ..........................................................................................................................................................................................74 Properties................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 11 width ..................................................................................................................................................................................82 CountItem .......................................................................................................................................................................................83 Properties...............................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 12 Document .......................................................................................................................................................................................88 Properties..................................................................................................................................................................................88 activeChannels .......................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 13 mergeVisibleLayers.......................................................................................................................................................92 paste...................................................................................................................................................................................92 print ...........................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 14 city.......................................................................................................................................................................................99 copyrighted .....................................................................................................................................................................99 copyrightNotice ......................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 15 path.................................................................................................................................................................................. 105 pathName...................................................................................................................................................................... 105 typename .................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 16 includeCopyright........................................................................................................................................................ 111 includeCredits.............................................................................................................................................................. 111 includeFilename...........................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 17 colors............................................................................................................................................................................... 116 dither............................................................................................................................................................................... 116 ditherAmount .......................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 18 matte............................................................................................................................................................................... 123 palette............................................................................................................................................................................. 123 preserveExactColors ..................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 19 LayerSet ........................................................................................................................................................................................ 129 Properties............................................................................................................................................................................... 129 allLocked...........................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 20 parent.............................................................................................................................................................................. 136 typename ...................................................................................................................................................................... 136 Methods ...................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 21 typename ...................................................................................................................................................................... 144 PathPoints.................................................................................................................................................................................... 146 Properties.......................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 22 transparency................................................................................................................................................................. 149 typename ...................................................................................................................................................................... 149 useOutlines ......................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 23 typename ...................................................................................................................................................................... 155 PixarSaveOptions ...................................................................................................................................................................... 156 Properties..............................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 24 savePaletteLocations ................................................................................................................................................ 160 showAsianTextOptions ............................................................................................................................................ 160 showEnglishFontNames ...................................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 25 bounds............................................................................................................................................................................ 166 parent.............................................................................................................................................................................. 166 solid ..................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 26 operation ....................................................................................................................................................................... 173 typename ...................................................................................................................................................................... 173 SubPathItem...................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 27 firstLineIndent.............................................................................................................................................................. 180 font................................................................................................................................................................................... 180 hangingPunctuation .......................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 28 annotations................................................................................................................................................................... 186 byteOrder ...................................................................................................................................................................... 186 embedColorProfile...............................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 29 ColorSpaceType .......................................................................................................................................................... 200 CopyrightedType........................................................................................................................................................ 200 CreateFields .................................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 30 OperatingSystem........................................................................................................................................................ 207 Orientation.................................................................................................................................................................... 207 OtherPaintingCursors ...................................................................................
Adobe Photoshop CS6 JavaScript Scripting Reference 31 UndefinedAreas .......................................................................................................................................................... 214 UnderlineType ............................................................................................................................................................. 214 Units.....................................................................................................
1 Introduction This reference describes the objects and methods in the Adobe® Photoshop® CS6® JavaScriptTM type library. A companion document, Photoshop CS6 Scripting Guide, describes basic scripting concepts and the Photoshop object model. This document provides reference details of the Photoshop object model, and additional information on JavaScript-specific features. Adobe Photoshop CS6 uses ExtendScript, Adobe’s extended implementation of JavaScript.
Adobe Photoshop CS6 JavaScript Scripting Reference ● Introduction 33 In Mac OS: Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS6/SDK The latest versions of this document and of the ExtendScript Tookit, can also be downloaded from Adobe Developer Center, http://www.adobe.com/devnet/. Executing scripts The Adobe Photoshop CS6 interface includes a Scripts menu (File > Scripts) which provides quick and easy access to your JavaScripts.
Adobe Photoshop CS6 JavaScript Scripting Reference Introduction 34 Object model usage and naming The JavaScript API follows JavaScript naming conventions in that all classes (object types) begin with uppercase letters and have mixed case. Typically, in JavaScript, you instantiate classes using the new operator: new ClassName(); However, in the Photoshop Object Model, it is often not necessary to do this.
2 JavaScript Object Reference The Photoshop objects (the JavaScript type library for Adobe® Photoshop® CS6) are presented alphabetically and in tabular format in this chapter. Sample code for several object model classes is given to help illustrate the syntax as well as usage of the object class. Object descriptions Object properties and methods are described in separate tables for each object. The following sections describe the conventions used in these descriptions.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns crop (bounds [, angle] [, width] [, height]) array of 4 UnitValue number UnitValue UnitValue 36 What it does Crops the document. The bounds parameter is an array of four coordinates for the region remaining after cropping, [left, top, right, bottom].
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 37 ActionDescriptor This object provides a dictionary-style mechanism for storing data as key-value pairs. It can be used for low-level access into Photoshop. See an example of this usage in ‘Selection sample script’ on page 168. Many configuration files use serialized action descriptors to represent their data. It is used, for example, to encapsulate playback options in Application.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type getLargeInteger (key) (key) ActionDescriptor putBoolean (key, value) number boolean putClass (key, value) number number putData (key, value) number string putDouble (key, value) number number putEnumerated (key, enumType, value) File Gets the value of a key of type File. ActionReference Gets the value of a key of type ActionReference. string Gets the value of a key of type string.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns number number Sets the value for a key whose type is large integer. putLargeInteger (key, value) number number Sets the value for a key whose type is an ActionList object. putList (key, value) number ActionList Sets the value for a key whose type is an object, represented by an Action Descriptor.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 40 ActionList This object provides an array-style mechanism for storing data. It can be used for low-level access into Photoshop. This object is ideal when storing data of the same type. All items in the list must be of the same type. You can use the "put" methods, such as putBoolean(), to append new elements, and can clear the entire list using clear(), but cannot otherwise modify the list.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns What it does (Continued) number Gets the value of a list element of type large integer. ActionList Gets the value of a list element of type list. number Gets the class ID of a list element of type object. ActionDescriptor Gets the value of a list element of type object. File Gets the value of a list element of type File.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type number ActionDescriptor Appends a new value, a path. putPath (value) File putReference (value) ActionReference string putUnitDouble (classID, value) Appends a new value, a reference to an object created in the script. Appends a new value, a string. putString (value) What it does (Continued) Appends a new value, an object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 43 ActionReference This object provides information about what the action is refering to. For example, when referring to the name of something you might use keyName. The reference would also need to know what name you are referring to. In this case you could use classDocument for the name of the document or classLayer for the name of the layer. It can be used for low-level access into Photoshop.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Puts a new class form and class type into the reference. number number number Puts an enumeration type and ID into a reference along with the desired class for the reference.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 45 Application The Adobe Adobe Photoshop CS6 application object, which is the root of the object model and provides access to all other objects. This object provides application-wide information, such as application defaults and available fonts. It provides many important methods , such as those for opening files and loading documents. To access the properties and methods, you can use the pre-defined global variable app.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference Property Value type What it is (Continued) locale string Read-only. The language location of the application. 46 An Adobe locale code consists of a 2-letter ISO-639 language code and an optional 2-letter ISO 3166 country code separated by an underscore. Case is significant. For example, en_US, en_UK, ja_JP, de_DE, fr_FR. macintoshFileTypes array of string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference Property Value type What it is (Continued) version string Read-only. The version of Adobe Photoshop application you are running. windowsFileTypes array of string Read-only. A list of file image extensions Adobe Photoshop CS6 can open.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type What it does (Continued) ActionDescriptor Retreives user objects in the getCustomOptions (key) Returns 48 string Photoshop registry for the ID with value key. boolean isQuicktimeAvailable Returns true if Quicktime is installed. () Loads a support file (as opposed to a Photoshop image document) from the specified location.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type open (document [, as] [, asSmartObject]) Returns What it does (Continued) Document Opens the specified document.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type showColorPicker Returns What it does (Continued) boolean Returns false if dialog is cancelled, true otherwise. number Converts from a string ID to a runtime ID. () stringIDToTypeID string (stringID) 50 Toggle palette visibility. togglePalettes () typeIDToCharID typeIDToStringID (typeID) string Converts from a runtime ID to a character ID.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference // set the colors if (answer) { // I don’t have a favorite color. Why did I ask you may wonder? app.foregroundColor.rgb.red = Math.random() * 255 app.foregroundColor.rgb.green = Math.random() * 255 app.foregroundColor.rgb.blue = Math.random() * 255 app.backgroundColor.rgb.red = Math.random() * 255 app.backgroundColor.rgb.green = Math.random() * 255 app.backgroundColor.rgb.blue = Math.random() * 255 } // Open a document if (app.
Adobe Photoshop CS6 JavaScript Scripting Reference alert("Presentation file saved to: " + outputFile.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 53 ArtLayer An object within a document that contains the visual elements of the image (equivalent to a layer in the Adobe Photoshop CS6 application). Access an art layer in a document through the Document.artLayers collection. You can access a layer by name; for example: var layerRef = app.activeDocument.artLayers.getByName("my layer"); layerRef.allLocked = true; Access the art layers in a layer set through the LayerSet.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference Property Value type What it is (Continued) layerMaskFeather double Read-write. The feather of the layer mask (between 0.0 and 250.0) linkedLayers array of ArtLayer Read-only. The layers linked to this layer. See or LayerSet 54 ArtLayer.link. Read-write. The name. name string opacity number [0.0..100.0]. Read-write. The master opacity of the layer, a percentage value. parent Document Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 55 Methods Method Parameter type number number adjustColorBalance ([shadows] [, midtones] [, highlights] [, preserveLuminosity] What it does Adjusts the brightness in the range [-100..100] and contrast [-100..100]. adjustBrightnessContrast (brightness, contrast) Returns array of number array of number array of number boolean Adjusts the color balance of the layer’s component channels.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type What it does (Continued) Applies the De-Interlace filter. applyDeInterlace (eliminateFields, createFields) Returns 56 EliminateFields CreateFields Applies the Despeckle filter. applyDespeckle () Applies the Difference Clouds filter. applyDifferenceClouds () Applies the Diffuse Glow filter. applyDiffuseGlow (graininess, glowAmount, clearAmount) number [0..10] number [0..20] number [0..
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type What it does (Continued) Applies the Lens Blur filter.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type applyMinimum (radius) number [1..100] What it does (Continued) Applies the Minimum filter within the specified radius (in pixels) (1 - 100). Applies the Motion Blur filter. applyMotionBlur (angle, radius) Returns 58 number [-360..360] number [1..999] Applies the NTSC colors filter. applyNTSC () Applies the Ocean Ripple filter. applyOceanRipple (size, magnitude) number [1..15] number [0..
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type number [0.1..100.0] number [0.1..100.0] SmartBlurQuality SmartBlurMode Applies the Spherize filter. applySpherize (amount, mode) number [-100..100] SpherizeMode applyStyle (styleName) string Applies the Twirl filter. number [-999..999] applyUnSharpMask (amount, radius, threshold) number [1..500] number [0.1..250.0] number [0..255] number [1..999] number [1..998] number [2..min+1] number[1..
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type copy ([merge]) boolean Returns 60 What it does (Continued) Copies the layer to the clipboard. When the optional argument is set to true, a merged copy is performed (that is, all visible layers are copied to the clipboard). Cuts the layer to the clipboard. cut () Converts a color image to a grayscale image in the current color mode by assigning equal values of each component color to each pixel.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type mixChannels (outputChannels [, monochrome]) array of array of number boolean Returns 61 What it does (Continued) Modifies a targeted (output) color channel using a mix of the existing color channels in the image. The outputChannels parameter is an array of channel specifications. For each component channel, specify a list of adjustment values in the range [-200..
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Resizes the layer to the specified dimensions (as a percentage of its current size) and places it in the specified position. number AnchorPosition Rotates rotates the layer around the specified anchor point (default: MIDDLECENTER).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference // Save the current preferences var startRulerUnits = app.preferences.rulerUnits var startTypeUnits = app.preferences.typeUnits var startDisplayDialogs = app.displayDialogs // Set Adobe Photoshop CS6 to use pixels and display no dialogs app.preferences.rulerUnits = Units.PIXELS app.preferences.typeUnits = TypeUnits.PIXELS app.displayDialogs = DialogModes.NO //Close all the open documents while (app.documents.length) { app.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference } } // sort the layers by name for (var x = 0; x < app.activeDocument.layers.length; x++) { for (var y = 0; y < app.activeDocument.layers.length - 1 - x; y++) { // Compare in a non-case sensitive way var doc1 = app.activeDocument.layers[y].name var doc2 = app.activeDocument.layers[y + 1].name if (doc1.toUpperCase() > doc2.toUpperCase()) { app.activeDocument.layers[y].move(app.activeDocument.layers[y+1], ElementPlacement.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 65 ArtLayers The collection of ArtLayer objects in a document or layer set. Access through the Document.artLayers or LayerSet.artLayers collection. For example: var layerRef = docRef.artLayers.add() Properties Property Value type What it is length number Read-only. The number of elements in the artLayers collection. parent Document Read-only. The object's container. typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 66 BatchOptions Options for running a batch operation using the Application.batch() method. JavaScript only supports folders as sources for batch commands. Specify the batch source folder as the inputFiles parameter of the Application.batch() method. Properties Property Value type What it is destination BatchDestinationType Read-write. The type of destination for the processed files (default: BatchDestinationType.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 67 Property Value type What it is (Continued) suppressProfile boolean Read-write. True to suppress the color profile warnings (default: false). typename string Read-only. The class name of the referenced batchOptions object. unixCompatible boolean Read-write. True to make the final file name Unix compatible (default: true). Valid only when destination = BatchDestinationType.FOLDER.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 68 BitmapConversionOptions Options for converting an image to bitmap mode, using Document.changeMode() with ChangeMode.Bitmap. Convert color images to grayscale before converting the image to bitmap mode. See the ArtLayer.desaturate() method. Properties Property Value type What it is angle number [-180..180] Read-write. The angle (in degrees) at which to orient individual dots. See shape.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 69 BMPSaveOptions Options for saving a document in BMP format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. depth BMPDepthType Read-write. The number of bits per channel. flipRowOrder boolean Read-write. True to write the image from top to bottom (default: false). Available only when osType = OperatingSystem.WINDOWS.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 70 CameraRAWOpenOptions Options for opening a document in Camera RAW format using the Application.open() method. Properties Property Value type What it is bitsPerChannel BitsPerChannelType Read-write. The number of bits per channel. blueHue number [-100..100] Read-write. The blue hue of the shot. blueSaturation number [-100..100] Read-write. The blue saturation of the shot. brightness number [0..150] Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 71 Property Value type What it is (Continued) tint number [-150..150] Read-write. The tint of the shot. typename string Read-only. The class name of the referenced cameraRAWOpenOptions object. vignettingAmount number [-100..100] Read-write. The vignetting amount of the shot. vignettingMidpoint number [-100..100] Read-write. The vignetting mid point of the shot. whiteBalance WhiteBalanceType Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 72 Channel Information about a color element in the image. Access through the Document.channels collection. You can access an individual channel object in this list by index or by name. For example, this accesses a channel object in the active document by name and assigns an opacity value: var channelRef = app.activeDocument.channels.getByName("my channel"); channelRef.
Adobe Photoshop CS6 JavaScript Scripting Reference Method merge () remove () JavaScript Object Reference Parameter type Returns What it does Merges a spot channel into the component channels. Deletes the channel.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 74 Channels The collection of Channel objects in a document. Access through the Document.channels collection property. For example: var channelRef = app.activeDocument.channels.add() Properties Property Value type What it is length number Read-only. The number of elements in the channels collection. parent Document Read-only. The containing document. typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference case DocumentMode.GRAYSCALE: case DocumentMode.INDEXEDCOLOR: visibleChannelCount = 1 break; case DocumentMode.DUOTONE: visibleChannelCount = 2 break; case DocumentMode.RGB: case DocumentMode.LAB: visibleChannelCount = 3 break; case DocumentMode.CMYK: visibleChannelCount = 4 break; case DocumentMode.MULTICHANNEL: default: visibleChannelCount = inDocument.channels.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference // create the output file // first figure out which kind of line feeds we need if ($.os.search(/windows/i) != -1) { fileLineFeed = "Windows" } else { fileLineFeed = "Macintosh" } // create the output file accordingly fileOut = new File("~/Desktop/Histogram.log") fileOut.lineFeed = fileLineFeed fileOut.open("w", "TEXT", "????") // write out a header fileOut.write("Histogram report for " + docRef.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference } // close down the output file fileOut.close() alert("Histogram file saved to: " + fileOut.fsName) // reset the active channels docRef.activeChannels = myActiveChannels // Reset the application preferences app.preferences.rulerUnits = startRulerUnits app.preferences.typeUnits = startTypeUnits app.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference // I need an extra "0" for this line item to keep everything in line if (histogramIndex < 100) inOutFile.write("0") // output the index to file inOutFile.write(histogramIndex) // some spacing to make it look nice inOutFile.write(" ") // figure out how many X’s I need var outputX = inHistogram[histogramIndex] / largestCount * 100 // output the X’s for (var a = 0; a < outputX; a++) inOutFile.write("X") inOutFile.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference CMYKColor Defines a CMYK color, used in the SolidColor object. See also GrayColor, HSBColor, LabColor, NoColor, RGBColor Properties Property Value type What it is black number [0.0..100.00] Read-write. The black color value (as percent). cyan number [0.0..100.00] Read-write. The cyan color value (as percent). magenta number [0.0..100.00] Read-write. The magenta color value (as percent). typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 80 ColorSampler A color sampler for a document. Access through the Document.colorSamplers collection. For example: var colorSamplerRef = app.activeDocument.colorSamplers[0]; var currentColor = colorSamplerRef.color; Note: For additional information about color samplers, see Adobe Photoshop CS6 help on the Color SamplerTool. Properties Property Value type What it is color SolidColor Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference ColorSamplers The collection of ColorSampler objects in a document. Access through the Document.colorSamplers collection property. For example: app.activeDocument.colorSamplers.removeAll() Properties Property Value type What it is length number Read-only. The number of elements in the ColorSamplers collection. parent Document Read-only. The containing document. typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 82 ContactSheetOptions Options for creating a contact sheet with the Application.makeContactSheet() method. Properties Property Value type What it is acrossFirst boolean Read-write. True to place the images horizontally (left to right, then top to bottom) first (default: true). bestFit boolean Read-write. True to rotate images for the best fit (default: false). caption boolean Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 83 CountItem A counted item in a document. Access through the Document.countItems collection. See the Document.autoCount() method. Note: This feature is available in the Extended Version only. For additional information about count items, see Adobe Photoshop CS6 help on the Count Tool. Properties Property Value type What it is position array of UnitValue Read-only. The position of the count item in the document.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 84 CountItems The collection of CountItem objects in the document. Access through the Document.countItems collection property. For example: app.activeDocument.countItems.removeAll() Note: This feature is available in the Extended Version only. Properties Property Value type What it is length number Read-only. The number of elements in the CountItems collection. parent Document Read-only. The containing document.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference DCS1_SaveOptions Options for saving a CMYK document in DCS1 format using the Document.saveAs() method. Properties Property Value type What it is dCS DCSType Read-write. (default: DCSType.COLORCOMPOSITE). embedColorProfile boolean Read-write. True to embed the color profile in the document encoding SaveEncoding Read-write. The type of encoding to use for document (default: SaveEncoding.BINARY ).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 86 DCS2_SaveOptions Options for saving a CMYK document in DCS2 format using the Document.saveAs() method. Properties Property Value type What it is dCS DCSType Read-write. The type of composite file to create (default: DCSType.NOCOMPOSITE). embedColorProfile boolean Read-write. True to embed the color profile in the document. encoding SaveEncoding Read-write. The type of encoding to use (default: SaveEncoding.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference DICOMOpenOptions Options for opening a document in DICOM format using the Application.open() method. Note: This feature is available in the Extended Version only. Properties Property Value type What it is anonymize boolean Read-write. True to make the patient information anonymous. columns number Read-write. Number of columns in n-up configuration. reverse boolean Read-write. True to reverse (invert) the image.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 88 Document The active containment object for layers and all other objects in the script; the basic canvas for the file. ● Access the object for the currently active document through Application.activeDocument. ● You can access other documents, or iterate through all open documents using the list in the Application.documents collection. You can access individual documents in the list by index, or use Documents.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference Property Value type What it is (Continued) countItems CountItems Read-only. The current count items. 89 Note: For additional information about count items, see Adobe Photoshop CS6 help on the Count Tool. fullName File Read-only. The full path name of the document. guides Guides Read-only. The guides collection. height UnitValue Read-only. The height of the document (unit value).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 90 Property Value type What it is (Continued) quickMaskMode boolean Read-write. True if the document is in Quick Mask mode. resolution number Read-only. The document’s resolution (in pixels per inch). saved boolean Read-only. True if the document has been saved since the last change. selection Selection Read-only. The selected area of the document. typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 91 Methods Method Parameter type Returns Counts the number of objects in a document. Available in the Extended Version only. autoCount (channel, threshold) What it does Channel number Creates a CountItem object for each object counted. For additional information about how to set up objects to count, see the Count Tool in the Adobe Photoshop CS6 Help Changes the color profile of the document.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns What it does (Continued) Exports the paths in the document to an Illustrator file, or exports the document to a file with Web or device viewing optimizations. exportDocument (exportIn [, exportAs] [, options]) 92 File ExportType ExportOptionsIllustrator —or— ExportOptionsSaveForWeb This is equivalent to choosing File > Export > Paths To Illustrator, or File > Save For Web and Devices.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns What it does (Continued) Expands the document to show clipped sections. revealAll () Rotates the canvas (including the image) in clockwise direction. rotateCanvas (angle) 93 number Saves the document. save () Saves the document in a specific format.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 94 Document sample script The following script creates a document that contains two images (a sunflower and a duck) obtained from the Adobe Photoshop CS6 Samples folder and employs the following steps: ● Determines which image is larger. ● Resizes the smaller image to match the larger image. ● Creates a merged document twice as high as either image in order to hold both images.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference var selRegion = Array(Array(0, 0), Array(mergedDoc.width.value, 0), Array(mergedDoc.width.value, mergedDoc.height.value / 2), Array(0, mergedDoc.height.value / 2), Array(0, 0)) // Create the selection mergedDoc.selection.select(selRegion) //Paste in the flower mergedDoc.paste(TRUE) // do the same thing for the duck app.activeDocument = duckDoc duckDoc.activeLayer.copy() app.activeDocument = mergedDoc mergedDoc.selection.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 96 DocumentPrintSettings The print settings for a document. Properties Property Value type What it is backgroundColor SolidColor Read-write. Background color of page. bleedWidth UnitValue Read-write. Bleed width caption boolean Read-write. Print the caption found in FileInfo. centerCropMarks boolean Read-write. Print center crop marks. colorBars boolean Read-write. Print color calibration bars.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference Property Value type What it is (Continued) scale number Read-only. Scale of image on page. vectorData boolean Read-write. Include vector data.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 98 Methods Method Parameter type What it does Set the position of the image on the page.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 99 DocumentInfo Metadata about a document object. Access through the Document.info property. For example, the following sets the author, caption, and copyrighted properties: var docRef = open(fileList[i]) // set the file info docRef.info.author = "Mr. Adobe programmer" docRef.info.caption = "Adobe Photo shoot" docRef.info.copyrighted = CopyrightedType.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 100 Property Value type What it is (Continued) parent Document Read-only. The info object's container. provinceState string Read-write. source string Read-write. supplementalCategories array of string Read-write. title string Read-write. transmissionReference string Read-write. typename string Read-only. The class name of the referenced info object. urgency Urgency Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 101 // save the outputs in JPEG var jpegOptions = new JPEGSaveOptions() // set the jpeg quality really low so the files are small jpegOptions.quality = 1 // open each one in turn for (var i = 0; i < fileList.length; i++) { // The fileList includes both folders and files so open only files if (fileList[i] instanceof File && fileList[i].
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 102 Documents The collection of open Document objects. Access this list through the Application.documents collection property, which is available through the app global variable, or directly at the top level. For example, the following adds a new document to the collection: app.documents.add(800, 500, 72, "myDocument", NewDocumentMode.RGB) —or— documents.add(800, 500, 72, "myDocument", NewDocumentMode.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 103 EPSOpenOptions Options for opening a document in EPS format using the Application.open() method. Properties Property Value type What it is antiAlias boolean Read-write. True to use antialias. constrainProportions boolean Read-write. True to constrain the proportions of the image. height UnitValue Read-write. The height of the image (unit value). mode OpenDocumentMode Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 104 EPSSaveOptions Options for saving a document in EPS format using the Document.saveAs() method. Properties Property Value type What it is embedColorProfile boolean Read-write. True to embed the color profile in this document. encoding SaveEncoding Read-write. The type of encoding to use (default: SaveEncoding.BINARY ). halftoneScreen boolean Read-write. True to include the halftone screen (default: false).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 105 ExportOptionsIllustrator Options for exporting PathItem objects to an Adobe Illustrator® file using using the Document.exportDocument() method. These options are the options that you can provide when you choose File > Export > Paths To Illustrator. Properties Property Value type What it is path IllustratorPathType Read-write. The type of path to export (default: IllustratorPathType.DOCUMENTBOUNDS).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 106 ExportOptionsSaveForWeb Options for optimizing a document for the web or devices using the Document.exportDocument() method. These are the options that you can provide when you choose File > Save For Web and Devices. Properties Property Value type What it is blur number Read-write. Applies blur to the image to reduce artifacts (default: 0.0). colorReduction ColorReductionType Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 107 Property Value type What it is (Continued) quality number [0..100] Read-write. The quality of the produced image as a percentage; default: 60. transparency boolean Read-write. Indication of transparent areas of the image should be included in the saved image(default: true). transparencyAmount number Read-write. The amont of transparency dither (default: 100). Valid only if transparency = true.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference File Folder ExtendScript defines the JavaScript classes File and Folder to encapsulate file-system references in a platform-independent manner; see ‘JavaScript support in Adobe Photoshop CS6’ on page 32. For references details of these classes, see the JavaScript Tools Guide.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 109 GalleryBannerOptions Options for the bannerOptions property of the GalleryOptions object. Tip: You can preserve default values for many of these properties by setting the GalleryOptions property preserveAllMetadata to true; this is the same as choosing File > Automate > Web Photo Gallery, and then choosing Preserve all metadata in the Options area of the Web Photo Gallery dialog.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 110 GalleryCustomColorOptions Options for the customColorOptions property of the GalleryOptions object. Tip: You can preserve default values for many of these properties by setting the GalleryOptions property preserveAllMetadata to true; this is the same as choosing File > Automate > Web Photo Gallery, and then choosing Preserve all metadata in the Options area of the Web Photo Gallery dialog.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 111 GalleryImagesOptions Options for the imagesOptions property of the GalleryOptions object. Tip: You can preserve default values for many of these properties by setting the GalleryOptions property preserveAllMetadata to true; this is the same as choosing File > Automate > Web Photo Gallery, and then choosing Preserve all metadata in the Options area of the Web Photo Gallery dialog.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference Property Value type What it is (Continued) resizeConstraint GalleryConstrainType Read-write. The image dimensions to constrain in the gallery image (default: 112 GalleryConstrainType.CONSTRAINBOTH). Valid only when resizeImages = true. resizeImages boolean Read-write. True to automatically resize images for placement on the gallery pages (default: true). typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 113 GalleryOptions Options for a Web photo gallery, created with Application.makePhotoGallery(). Tip: You can preserve default values for many of these properties by choosing File > Automate > Web Photo Gallery, and then choosing Preserve all metadata in the Options area of the Web Photo Gallery dialog. Properties Property Value type What it is addSizeAttributes boolean Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 114 GallerySecurityOptions Options for the securityOptions property of the GalleryOptions object. Tip: You can preserve default values for many of these properties by setting the GalleryOptions property preserveAllMetadata to true; this is the same as choosing File > Automate > Web Photo Gallery, and then choosing Preserve all metadata in the Options area of the Web Photo Gallery dialog.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 115 GalleryThumbnailOptions Options for the thumbnailOptions property of the GalleryOptions object. Tip: You can preserve default values for many of these properties by setting the GalleryOptions property preserveAllMetadata to true; this is the same as choosing File > Automate > Web Photo Gallery, and then choosing Preserve all metadata in the Options area of the Web Photo Gallery dialog.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 116 GIFSaveOptions Options for saving a document in GIF format using the Document.saveAs() method. Properties Property Value type What it is colors number Read-write. The number of palette colors. Valid only when palette = Palette.LOCALADAPTIVE, LOCALPERCEPTUAL, LOCALSELECTIVE, MACOSPALETTE, UNIFORM, WEBPALETTE; or WINDOWSPALETTE . dither Dither Read-write. The dither type. ditherAmount number [1..100] Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 117 GrayColor Defines a gray color, used in the SolidColor object. See also CMYKColor, HSBColor, LabColor, NoColor, RGBColor Properties Property Value type What it is gray number [0.0..100.0] Read-write. The gray value (default: 0.0). typename string Read-only. The class name of the referenced grayColor object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 118 Guide Properties Property Value type What it is direction Direction Read-write. Indicates whether the guide is vertical or horizontal. coordinate UnitValue Read-write. Location of the guide from origin of image.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 119 Guides The collection of open Guide objects. Access this list through the Document.guides collection property, which is available through the activeDocument object. For example, the following adds a new guide to the collection: activeDocument.guides.add (Direction.HORIZONTAL,UnitValue(20,20)) Properties Property Value type What it is length number Read-only. The number of elements in the guides collection.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 120 HistoryState A version of the document stored automatically (and added to the HistoryStates collection), which preserves the document’s state, each time the document is changed. Access through Document.historyStates collection. You can access a state in the list by name. For example, this assigns a property value in the state object named "AddLayerMask": var stateRef = app.activeDocument.historyState.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 121 HistoryStates The collection of Guide objects in the document. Access through Document.historyStates collection property. For example, this accesses one of the states in the collection by index: myState = app.activeDocument.historyStates[7]; Properties Property Value type What it is length number Read-only. The number of elements in the HistoryStates collection. parent Document Read-only. The containing document.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference HSBColor Defines an HSB color, used in the SolidColor object. See also CMYKColor, GrayColor, LabColor, NoColor, RGBColor Properties Property Value type What it is brightness number[0.0..100.0] Read-write. The brightness value. hue number [0.0..360.0] Read-write. The hue value. saturation number [0.0..100.0] Read-write. The saturation value. typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 123 IndexedConversionOptions Options for converting an RGB image to an indexed color model using Document.changeMode(). Properties Property Value type What it is colors number Read-write. The number of palette colors. Valid only when palette = Palette.LOCALADAPTIVE, LOCALPERCEPTUAL, LOCALSELECTIVE, MACOSPALETTE, UNIFORM, WEBPALETTE, or WINDOWSPALETTE. dither Dither Read-write. The dither type.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 124 JPEGSaveOptions Options for saving a document in JPEG format using the Document.saveAs() method. Properties Property Value type What it is embedColorProfile boolean Read-write. True to embed the color profile in the document. formatOptions FormatOptions Read-write.The download format to use (default: FormatOptions.STANDARDBASELINE). matte MatteType Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference LabColor Defines an LAB color, used in the SolidColor object. See also CMYKColor, GrayColor, HSBColor, NoColor, RGBColor Properties Property Value type What it is a number [-128.0..127.0] Read-write. The a-value. b number [-128.0..127.0] Read-write. The b-value. l number [0.0..100.0] Read-write. The L-value. typename string Read-only. The class name of the referenced LabColor object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 126 LayerComp A snapshot of a state of the layers in a document, which can be used to view different page layouts or compositions. Access through Document.layerComps collection. You can access a layer comp by its name. For example, this sets the comment property value for a LayerComp object named myLayerComp: var layercompRef = app.activeDocument.layerComps.getByName("myLayerComp"); layercompRef.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 127 LayerComps The collection of LayerComp objects in the document. Access through the Document.layerComps collection property. For example: app.activeDocument.layerComps.add("myLayerComp", "View from Shoreline", true, true, true); Properties Property Value type What it is length number Read-only. The number of elements in the layerComps collection. parent Document Read-only. The containing document.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 128 Layers The collection of layer objects, including ArtLayer and LayerSet objects, in the document. Access through Document.layers, or the LayerSet.layers collections properties. For example, this uses the length property to count the number of layer objects in the active document, then displays the number on the screen: var layerNum = app.activeDocument.layers.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 129 LayerSet A group of layer objects, which can include ArtLayer objects and other (nested) LayerSet objects. A single command can manipulate all layers in the set. Access top-level layers sets in a document through the Document.layerSets collection. You can access a layer set by name. For example, the following sets the allLocked value for "myLayerSet": var layerSetRef = app.activeDocument.layerSets.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 130 Methods Method Parameter type LayerSet duplicate ([relativeObject] [, insertionLocation]) Returns ArtLayer LayerSet Links the layer set with another layer. or ArtLayer merge () insertionLocation) Merges the layerset; returns a reference to the art layer created by this method. Moves the object. move (relativeObject, Creates a duplicate of the object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 131 LayerSets The collection of LayerSet objects in the document. Access the top-level layer sets in a document through the Document.layerSets collection property. For example: var layerSetRef = app.activeDocument.layerSets.add() Access the nested layer sets through the LayerSet.layerSets collection property in the parent set. For example: var layerSetRef = app.activeDocument.layerSets.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference app.activeDocument.close() } // create a working document var docRef = app.documents.add() // create an array to hold the layer sets var myLayerSets = new Array() // Create an array to hold the text var textArray = Array("First", "Second", "Third") //Create an indexer variable var i = 0 // Create three layer sets at the top level for (i = 0; i < 3; i++) { myLayerSets[i] = new Array() myLayerSets[i][0] = docRef.layerSets.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference MeasurementLog The measurement log for the application. Access through the Application.measurementLog property. Note: This feature is available in the Extended Version only. Methods Method Parameter type File MeasurementRange array of string deleteMeasurements ([range]) What it does Export measurement to a file.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 134 MeasurementScale The measurement scale for the document. Access through the Document.measurementScale property. For example: app.activeDocument.measurementScale.pixelLength = 25 Note: This feature is available in the Extended Version only. Properties Property Value type What it is pixelLength number Read-write. The length in pixels this scale equates to. logicalLength number Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference NoColor Represents a missing color object, used in the SolidColor object. See also CMYKColor, GrayColor, HSBColor, LabColor, RGBColor Properties Property Value type What it is typename string Read-only. The class name of the referenced noColor object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 136 Notifier An event-handler object that tells a script to execute specified code when a specified event occurs. Notifiers must be enabled using the Application.notifiersEnabled property. Access through the Application.notifiers collection. Note: Events that occur within scripts do not generally trigger notifiers, because they occur inside a "play script" event.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 137 Notifiers The collection of Notifier objects in the document. Access through the Application.notifiers collection property. For example: var notRef = app.notifiers.add("OnClickGoButton", eventFile) Notifiers must be enabled using the Application.notifiersEnabled property. Properties Property Value type What it is length number Read-only. The number of elements in the notifiers collection.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 138 PathItem A path or drawing object, such as the outline of a shape or a straight or curved line, which contains sub paths that define its geometry. Access through the collection in the Document.pathItems property. For example, this selects a named path item: var currentPathItem = app.activeDocument.pathItems.getByName("myPath"); currentPathItem.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns makeClippingPath ([flatness]) number [0.2..100] makeSelection ([feather] [, antiAlias] [, operation]) number [0.0..250.0] boolean SelectionType 139 What it does Makes this the clipping path for this document. flatness tells the PostScript printer how to approximate curves in the path. Makes a Selection object whose border is this path. feather is in pixels. Deletes this object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference lineArray[0].leftDirection = lineArray[0].anchor lineArray[0].rightDirection = lineArray[0].anchor lineArray[1] = new PathPointInfo lineArray[1].kind = PointKind.CORNERPOINT lineArray[1].anchor = Array(150, 200) lineArray[1].leftDirection = lineArray[1].anchor lineArray[1].rightDirection = lineArray[1].anchor var lineSubPathArray = new Array() lineSubPathArray[0] = new SubPathInfo() lineSubPathArray[0].
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference lineSubPathArray[2] = new SubPathInfo() lineSubPathArray[2].operation = ShapeOperation.SHAPEXOR lineSubPathArray[2].closed = false lineSubPathArray[2].entireSubPath = lineArray3 //create the path item var myPathItem = docRef.pathItems.add("A Line", lineSubPathArray) // stroke it so we can see something myPathItem.strokePath(ToolType.BRUSH) // Reset the application preferences preferences.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 142 PathItems The collection of PathItem objects in a document. Access through the Document.pathItems collection property. For example, this creates a new path item using a previously-defined set of subpaths: app.activeDocument.pathItems.add("myPath", lineSubPathInfoArray); Properties Property Value type What it is length number Read-only. The number of pathItem objects in the pathItems collection.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 143 PathPoint Represents the anchor and control-handle endpoints for a path segment. Each point (the anchor point, left-direction point, and right-direction point) is an array containing X and Y position coordinates. ● Use the PathPoint object to retrieve information about the points that describe existing path segments. The properties are read-only. Access PathPoint objects through the SubPathItem.pathPoints property.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 144 PathPointInfo Used to create a PathPoint, which represents the anchor and control-handle endpoints for a path segment. Each point (the anchor point, left-direction point, and right-direction point) is an array containing X and Y position coordinates. ● Use the JavaScript new operator to create these objects, and store them in the SubPathInfo.
Adobe Photoshop CS6 JavaScript Scripting Reference var spi = new SubPathInfo(); spi.closed = false; spi.operation = ShapeOperation.SHAPEXOR; spi.entireSubPath = [startPoint, stopPoint]; var line = doc.pathItems.add("Line", [spi]); line.strokePath(ToolType.PENCIL); line.remove(); }; drawLine(app.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 146 PathPoints A collection of PathPoint objects that define a subpath, kept in the SubPathItem.pathPoints property. Properties Property Value type What it is length number Read-only. The number of elements in the collection. parent SubPathItem Read-only. The containing subpath object. typename string Read-only. The class name of the referenced PathPoints object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 147 PDFOpenOptions Options for opening a document in generic Adobe PDF format using the Application.open() method. Properties Property Value type What it is antiAlias boolean Read-write. True to use antialias. bitsPerChannel BitsPerChannelType Read-write. The number of bits per channel. constrainProportions boolean DEPRECATED for Adobe Photoshop CS6. cropPage CropToType Read-write. The method of cropping to use.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 148 PDFSaveOptions Options for saving a document in Adobe PDF format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels with the file. annotations boolean Read-write. True to save comments with the file. colorConversion boolean Read-write. True to convert the color profile to a destination profile.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 149 Property Value type What it is (Continued) jpegQuality number [0..12] Read-write. The quality of the produced image, which is inversely proportionate to the compression amount. Valid only when encoding = PDFEncoding.JPEG . layers boolean Read-write. True to save the document’s layers. optimizeForWeb boolean Read-write. True to improve performance of PDF files on Web servers. outputCondition string Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 150 Property Value type What it is (Continued) vectorData boolean DEPRECATED for Adobe Photoshop CS6. view boolean Read-write. True to open the saved PDF in Adobe Acrobat.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 151 PhotoCDOpenOptions DEPRECATED in Adobe Photoshop CS6. Kodak PhotoCD is now found in the Goodies folder on the Adobe Photoshop CS6 Install DVD. Options for opening a document in Kodak Photo CD (PCD) format (including high-resolution files from Pro Photo CD discs) using the Application.open() method. Properties Property Value type What it is colorProfileName string Read-write. The profile to use when reading the image.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 152 PhotoshopSaveOptions Options for saving a document in PSD format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. annotations boolean Read-write. True to save the annotations. embedColorProfile boolean Read-write. True to embed the color profile in the document. layers boolean Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 153 PICTFileSaveOptions Options for saving a document in PICT format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. compression PICTCompression Read-write. The type of compression to use (default: PICTCompression.NONE). embedColorProfile boolean Read-write. True to embed the color profile in the document.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 154 PICTResourceSaveOptions Options for saving a document as a PICT Resource file using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. compression PICTCompression Read-write. The type of compression to use (default: PICTCompression.NONE). embedColorProfile boolean Read-write. True to embed the color profile in the document.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 155 PicturePackageOptions Options for a picture package created with Application.makePicturePackage(). Properties Property Value type What it is content PicturePackageTextType Read-write. The content information (default: PicturePackageTextType.NONE). flatten boolean Read-write. True if all layers in the final document are flattened (default: true). font GalleryFontType Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference PixarSaveOptions Options for saving a document in Pixar format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. typename string Read-only. The class name of the referenced PixarSaveOptions object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference PNGSaveOptions Options for saving a document in PNG format using the Document.saveAs() method. Properties Property Value type What it is compression number [0..9] Read-write. The compression value (default: 0). interlaced boolean Read-write. True to interlace rows (default: false). typename string Read-only. The class name of the referenced PNGSaveOptions object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 158 Preferences Represents application preferences for Photoshop. Access this object through the Application.preferences property. For example: app.preferences.rulerUnits = Units.PIXELS app.preferences.typeUnits = TypeUnits.PIXELS Setting values in this object is equivalent to selecting Edit > Preferences (in Windows) or Photoshop > Preferences (in Mac OS) in the Adobe Photoshop CS6 application.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 159 Property Value type What it is (Continued) exportClipboard boolean Read-write. True to retain Adobe Photoshop CS6 contents on the clipboard after you exit the application. fontPreviewSize FontPreviewType Read-write. The preferred type size to use for font previews in the type tool font menus. fullSizePreview boolean Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 160 Property Value type What it is (Continued) numberofHistoryStates number Read-write. The number of history states to preserve. otherCursors OtherPaintingCursors Read-write. The preferred type of pointer to use with certain tools. paintingCursors PaintingCursors Read-write. The preferred type of pointer to use with certain tools. parent Application Read-write. The containing application.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 161 Property Value type What it is (Continued) typeUnits TypeUnits Read-write. The preferred unit for text character measurements. useAdditionalPluginFolder boolean Read-write. True to use an additional folder for compatible plug-ins stored with a different application. useHistoryLog boolean Read-write. True to create a log file for history states. useLowerCaseExtension boolean Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 162 PresentationOptions Options for Adobe PDF presentations created using Application.makePDFPresentation(). Properties Property Value type What it is autoAdvance boolean Read-write. True to auto advance images when when viewing the presentation (default: true). Valid only when presentation = true. includeFilename boolean Read-write. True to include the file name for the image (default: false). interval number [1..
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 163 RawFormatOpenOptions Options for opening a document in RAW format using the Application.open() method. Properties Property Value type What it is bitsPerChannel number Read-write. The number of bits for each channel. The only valid values are BitsPerChannelType.EIGHT or BitsPerChannelType.SIXTEEN. byteOrder ByteOrder Read-write. The order in which multibyte values are read.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference RawSaveOptions Options for saving a document in RAW format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True if alpha channels should be saved. spotColors boolean Read-write. True if the spot colors should be saved. typename string Read-only. The class name of the referenced RawSaveOptions object.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 165 RGBColor Defines an RGB color, used in the SolidColor object. See also CMYKColor, GrayColor, HSBColor, LabColor, NoColor. Properties Property Value type What it is blue number [0..255] Read-write. The blue color value (default: 255). green number [0..255] Read-write. The green color value (default: 255) hexValue string Read-write. The hexadecimal representation of the color. red number [0..255] Read-write.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 166 Selection The selected area of a document or layer. Access through the Document.selection property. For example: app.activeDocument.selection.fill(app.foregroundColor) Many of the properties and methods use the UnitValue type, which combines measurement values with the measurement unit. For information about this type, see the JavaScript Tools Guide.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type SolidColor ColorBlendMode number [1..100] boolean grow (tolerance, antiAlias) What it does (Continued) Fills the selection. fill (filltype [, mode] [, opacity] [, preserveTransparency]) Returns 167 number boolean opacity is a percentage value. Grows the selection to include all adjacent pixels falling within the specified tolerance range.
Adobe Photoshop CS6 JavaScript Scripting Reference Method JavaScript Object Reference Parameter type Returns selectBorder (width) UnitValue similar (tolerance, antiAlias) number boolean smooth (radius) number store (into [, combination]) Channel SelectionType stroke (strokeColor, width [, location] [, mode] [, opacity] [, preserveTransparency]) SolidColor number StrokeLocation ColorBlendMode number [1..
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 169 var startTypeUnits = app.preferences.typeUnits var startDisplayDialogs = app.displayDialogs // Set Adobe Photoshop CS6 to use pixels and display no dialogs app.preferences.rulerUnits = Units.PIXELS app.preferences.typeUnits = TypeUnits.PIXELS app.displayDialogs = DialogModes.NO //Close all the open documents while (app.documents.length) { app.activeDocument.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference } // Fill the current selection with the foreground color checkersDoc.selection.fill(app.foregroundColor) //Invert the selection checkersDoc.selection.invert() // Fill the new selection with the background color checkersDoc.selection.fill(app.backgroundColor) // Clear the selection to get rid of the non-printing borders checkersDoc.selection.deselect() // Reset the application preferences app.preferences.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference SGIRGBSaveOptions Options for saving a document in SGIRGB format using the Document.saveAs() method. Note: The SGIRGB format is not installed automatically with Adobe Photoshop CS6. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. spotColors boolean Read-write. True to save the spot colors. typename string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference SolidColor A color definition used in the document. Maps a color to equivalents in all available color models. ● Used in Application.backgroundColor and foregroundColor properties, in Channel.color, in ColorSampler.color, and in TextItem.color ● Passed to PathItem.fillPath(), Selection.fill(), and Selection.stroke(). Properties Property Value type What it is cmyk CMYKColor Read-write. The CMYK color mode.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 173 SubPathInfo An array of PathPoint objects that describes a straight or curved segment of a path, used to create a SubPathItem. Pass an array of these objects to the PathItems.add() method. This method creates a SubPathItem object for each SubPathInfo object, and creates and returns a new PathItem object for the path represented by all of the subpaths. ● Use SubPathInfo to create subpaths; the properties are writeable.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 174 SubPathItem Represents a subpath; a collection of subpaths make up a PathItem. Create these objects by passing SubPathInfo objects to the PathItems.add() method. This method creates a SubPathItem object for each SubPathInfo object, and creates and returns a new PathItem object for the path represented by all of the subpaths. Access these objects in the PathItem.subPathItems collection.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference SubPathItems A collection of SubPathItem objects that make up a PathItem. Access this object in the PathItem.subPathItems collection property. ● Use SubPathInfo to create subpaths; the properties are writeable. ● Use the SubPathItem object to retrieve information about existing subpaths. The properties are read-only. Properties Property Value type What it is length number Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 176 TargaSaveOptions Options for saving a document in TGA (Targa) format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. resolution TargaBitsPerPixels Read-write. The number of bits per pixel (default: TargaBitsPerPixels.TWENTYFOUR). rleCompression boolean Read-write. True to use RLE compression (default: true).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 177 TextFont Describes a font that is available to the application. Access this object in the Application.fonts collection. For example: var myFont = app.fonts.getByName("ArialMT"); Properties Property Value type What it is family string Read-only. The font family. name string Read-only. The name of the font. parent Application Read-only. The containing application. postScriptName string Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 178 TextFonts The collection of fonts available on your computer. Fonts are represented by TextFont objects. Access this object in the Application.fonts collection property. For example, this displays the number of available fonts: alert(app.fonts.length); Properties Property Value type What it is length number Read-only. The number of elements in the collection. parent Application Read-only.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 179 TextItem The text in an ArtLayer object whose kind property is LayerKind.TEXT. Access this object in the ArtLayer.textItem property. For example: myLayers[i].textItem.contents = "Layer in " + textArray[i] + " Set Inside " Many of the properties use the UnitValue type, which combines a measurement value with a measurement unit. For information about this type, see the JavaScript Tools Guide.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 180 Property Value type What it is (Continued) desiredLetterScaling number [100..500] Read-write. The amount of space between letters (at 0, no space is added between letters). Equivalent to Letter Spacing in the Justification dialog (Select Justification on the Paragraphs palette menu). Valid only when justification = Justification.CENTERJUSTIFIED, FULLYJUSTIFIED, LEFTJUSTIFIED, or Justification.RIGHTJUSTIFIED.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 181 Property Value type What it is (Continued) hyphenateAfterFirst number [1..15] Read-write. The number of letters after which hyphenation in word wrap is allowed. hyphenateBeforeLast number [1..15] Read-write. The number of letters before which hyphenation in word wrap is allowed. hyphenateCapitalWords boolean Read-write. True to allow hyphenation in word wrap of capitalized words.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 182 Property Value type What it is (Continued) maximumLetterScaling number [100..500] Read-write. The maximum amount of space to allow between letters (at 0, no space is added between letters). Equivalent to Letter Spacing in the Justification dialog (Select Justification on the Paragraphs palette menu). Valid only when justification = Justification.CENTERJUSTIFIED, FULLYJUSTIFIED, LEFTJUSTIFIED, or Justification.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 183 Property Value type What it is (Continued) minimumLetterScaling number [100..500] Read-write. The minimum amount of space to allow between letters (a percentage value; at 0, no space is removed between letters). Equivalent to Letter Spacing in the Justification dialog (Select Justification on the Paragraphs palette menu). Valid only when justification = Justification.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 184 Property Value type What it is (Continued) spaceBefore UnitValue [-1296..1296] points Read-write. The amount of space to use before each paragraph. strikeThru StrikeThruType Read-write. The text strike-through option to use. textComposer TextComposer Read-write. The composition method to use to evaluate line breaks and optimize the specified hyphenation and justification options. Valid only when kind = TextType.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 185 Methods Method convertToShape () createPath () Parameter type Returns What it does Converts the text item and its containing layer to a fill layer with the text changed to a clipping path. Creates a clipping path from the outlines of the actual text items (such as letters or words).
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 186 TiffSaveOptions Options for saving a document in TIFF format using the Document.saveAs() method. Properties Property Value type What it is alphaChannels boolean Read-write. True to save the alpha channels. annotations boolean Read-write. True to save the annotations. byteOrder ByteOrder Read-write. The order in which the document’s multibyte values are read (default: ByteOrder.MACOS in Mac OS, ByteOrder.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 187 UnitValue ExtendScript defines the JavaScript class UnitValue to represent measurement values together with their measurement units; see ‘JavaScript support in Adobe Photoshop CS6’ on page 32. For references details of these classes, see the JavaScript Tools Guide.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Object Reference 188 xmpMetadata Camera RAW image XMP metadata. For camera RAW image files, the XMP metadata is stored in a sidecar file, which is a file in the same folder as the RAW file with the same base name and an XMP extension. Properties Property Value type What it is parent Document Read-only. The containing document. rawData string Read-write. A string containing the XMP metadata in XML (RDF) format.
3 JavaScript Resource This section describes the JavaScript resource that enables your JavaScripts to behave like a plug-in.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource Tag Description The category the command appears within in the menu. Used to group and order commands in the menu. Commands are placed in the menu alphabetically based on the string in . If two commands use the same category, they are grouped together. The terminology dictionary for the script to function with the Action Manager. See the Terminology dictionary.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource := (alpha | "_") {alpha | digit | "_" } := "*" | "/" := "+" | "-" := "==" | "!=" := "<" | "<=" | ">=" | ">" := "in" "(" {"," } ")" Operator precedence is shown in the following table.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource Constant Name Description Gray16Mode Grayscale mode, 16 bits per channel RGB48Mode RGB color mode, 16 bits per channel. Lab48Mode LAB mode, 16 bits per channel. CMYK64Mode CMYK mode, 16 bits per channel. DeepMultichannelMode Deep multichannel mode. Duotone16Mode Duotone mode, 16 bit depth. RGB96Mode RGB color mode, 32 bits per channel. Gray32Mode Grayscale mode, 32 bit depth.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource 193 Using the "in" function The in function (see ) returns true is the first parameter is equal to at least one of the subsequent parameters. A typical use might be to see if the image mode of the active document is one of a set of image modes.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource The /Events dictionary contains an entry for each event: /eventName [ (String event name) /direct parameter type << /parameterName [ (String name) /parameter type ] ...
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource Name Code Description typePaths 'Pth ' Windows file system path. typePlatformFilePath 'alis' or'Pth 195 typeAlias for Mac OS, typePath for Windows. Predefined Class Types Photoshop provides a number of predefined classes that are available for use in the terminology dictionary. A useful subset of those classes is shown in the table below.
Adobe Photoshop CS6 JavaScript Scripting Reference JavaScript Resource 196 The annotSizeClass has two properties: width, and height, both of type floatType. The enumeration annotType has three values: annotUnknown, annotText, and annotSound.
4 Scripting Constants This section lists and describes the enumerations defined for use with Adobe Photoshop CS6 JavaScript properties and methods. Constant type Values What it means AdjustmentReference ABSOLUTE RELATIVE Method to use for interpreting selective color adjustment specifications: ABSOLUTE = % of the whole. RELATIVE = % of the existing color amount. Pass to ArtLayer.selectiveColor().
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 198 Constant type Values What it means BitmapConversionType CUSTOMPATTERN DIFFUSIONDITHER HALFTHRESHOLD HALFTONESCREEN PATTERNDITHER Specifies the quality of an image you are converting to bitmap mode. Used in BitmapConversionOptions. BitmapHalfToneType CROSS DIAMOND ELLIPSE LINE ROUND SQUARE Specifies the shape of the dots (ink deposits) in the halftone screen. Used in BitmapConversionOptions.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 199 Constant type Values What it means ByteOrder IBM MACOS The platform-specific order in which multibyte values are read. CameraRAWSettingsType CAMERA CUSTOM SELECTEDIMAGE The default CameraRaw settings to use: the camera settings, custom settings, or the settings of the selected image. Set in CameraRAWOpenOptions. CameraRAWSize EXTRALARGE LARGE MAXIMUM MEDIUM MINIMUM SMALL The camera RAW size type options:.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 200 Constant type Values What it means ColorBlendMode BEHIND CLEAR COLOR COLORBURN COLORDODGE DARKEN DARKERCOLOR DIFFERENCE DISSOLVE EXCLUSION HARDLIGHT HARDMIXBLEND HUE LIGHTEN LIGHTERCOLOR LINEARBURN LINEARDODGE LINEARLIGHT LUMINOSITY MULTIPLY NORMAL OVERLAY PINLIGHT SATURATION SCREEN SOFTLIGHT VIVIDLIGHT The way color should be blended in a fill or stroke operation. Pass to PathItem.fillPath(), Selection.fill(), Selection.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 201 Constant type Values What it means CreateFields DUPLICATION INTERPOLATION The method to use for creating fields. Pass to ArtLayer.applyDeInterlace(). CropToType ARTBOX BLEEDBOX BOUNDINGBOX CROPBOX MEDIABOX TRIMBOX The style to use when cropping a page in a PDF document. Set in PDFOpenOptions.cropPage.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 202 Constant type Values What it means DisplacementMapType STRETCHTOFIT TILE Describes how the displacement map fits the image if the image is not the same size as the map. Pass to ArtLayer.applyDisplace(). Dither DIFFUSION NOISE NONE PATTERN The type of dithering to use in GIFSaveOptions, IndexedConversionOptions and ExportOptionsSaveForWeb.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 203 Constant type Values What it means FileNamingType DDMM DDMMYY DOCUMENTNAMELOWER DOCUMENTNAMEMIXED DOCUMENTNAMEUPPER EXTENSIONLOWER EXTENSIONUPPER MMDD MMDDYY SERIALLETTERLOWER SERIALLETTERUPPER SERIALNUMBER1 SERIALNUMBER2 SERIALNUMBER3 SERIALNUMBER4 YYDDMM YYMMDD YYYYMMDD File naming options for the BatchOptions used with the Application.batch() method.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 204 Constant type Values What it means GalleryFontType ARIAL COURIERNEW HELVETICA TIMESNEWROMAN The fonts to use for the Web photo gallery captions and other text. Used in GalleryBannerOptions, GalleryImagesOptions, and GalleryThumbnailOptions. Also used in PicturePackageOptions.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 205 Constant type Values What it means GuideLineStyle DASHED SOLID The preferred line style for nonprinting guides displayed over images, set in Preferences. IllustratorPathType ALLPATHS DOCUMENTBOUNDS NAMEDPATH The paths to export to an Illustrator file using Document.exportDocument().
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants Constant type Values What it means LayerKind BLACKANDWHITE BRIGHTNESSCONTRAST CHANNELMIXER COLORBALANCE CURVES EXPOSURE GRADIENTFILL GRADIENTMAP HUESATURATION INVERSION LEVELS NORMAL PATTERNFILL PHOTOFILTER POSTERIZE SELECTIVECOLOR SMARTOBJECT SOLIDFILL TEXT THRESHOLD LAYER3D VIBRANCE VIDEO The type of a layer object, in ArtLayer.kind. 206 Note: You can create a text layer only from an empty art layer.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 207 Constant type Values What it means NoiseDistribution GAUSSIAN UNIFORM Distribution method to use when applying an Add Noise filter. Pass to ArtLayer.applyAddNoise(). OffsetUndefinedAreas REPEATEDGEPIXELS SETTOBACKGROUND WRAPAROUND Method to use to fill the empty space left by offsetting a an image or selection. Pass to ArtLayer.applyOffset().
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 208 Constant type Values What it means OtherPaintingCursors PRECISEOTHER STANDARDOTHER The preferred pointer for the following tools: Eraser, Pencil, Paintbrush, Healing Brush, Rubber Stamp, Pattern Stamp, Smudge, Blur, Sharpen, Dodge, Burn, Sponge. Set in Preferences.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 209 Constant type Values What it means PDFResample NONE PDFAVERAGE PDFBICUBIC PDFSUBSAMPLE The down sample method to use. Used in PDFSaveOptions. PDFStandard NONE PDFX1A2001 PDFX1A2003 PDFX32002 PDFX32003 PDFX42008 The PDF standard to make the document compatible with. Used in PDFSaveOptions. PhotoCDColorSpace LAB16 LAB8 RGB16 RGB8 The color space for PhotoCDOpenOptions, deprecated in Photoshop CS3.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 210 Constant type Values What it means PointKind CORNERPOINT SMOOTHPOINT The role a PathPoint plays in a PathItem. PointType POSTSCRIPT TRADITIONAL The preferred measurement to use for type points, set in Preferences.pointSize: POSTSCRIPT = 72 points/inch. TRADITIONAL = 72.27 points/inch. PolarConversionType POLARTORECTANGULAR RECTANGULARTOPOLAR The method of polar distortion to use. Pass to ArtLayer.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 211 Constant type Values What it means ResampleMethod BICUBIC BICUBICSHARPER BICUBICSMOOTHER BILINEAR NEARESTNEIGHBOR NONE The method to use for image interpolation. Passed to Document.resizeImage(), and used as the value of Preferences.interpolation. RippleSize LARGE MEDIUM SMALL The size of undulations to use. Pass to ArtLayer.applyRipple().
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants Constant type Values What it means SelectionType DIMINISH EXTEND INTERSECT REPLACE The selection behavior when a selection already exists: 212 DIMINISH: Remove the selection from the already selected area. EXTEND: Add the selection to an already selected area. INTERSECT: Make the selection only the area where the new selection intersects the already selected area. REPLACE: Replace the selected area. Used in PathItem.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 213 Constant type Values What it means TextCase ALLCAPS NORMAL SMALLCAPS The capitalization style to use in text. Used in TextItem.capitalization. TextComposer ADOBEEVERYLINE ADOBESINGLELINE The composition method to use to optimize the specified hyphenation and justification options. Used in TextItem.textComposer. TextType PARAGRAPHTEXT POINTTEXT The type of text, used in TextItem.kind.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants Constant type Values What it means TrimType BOTTOMRIGHT TOPLEFT TRANSPARENT Type of pixels to trim around an image, passed to Document.trim().: 214 BOTTOMRIGHT = bottom right pixel color. TOPLEFT = top left pixel color. TypeUnits MM PIXELS POINTS The preferred unit for text character measurements, set in Preferences.
Adobe Photoshop CS6 JavaScript Scripting Reference Scripting Constants 215 Constant type Values What it means WaveType SINE SQUARE TRIANGULAR The type of wave to use. Pass to ArtLayer.applyWave(). WhiteBalanceType ASSHOT AUTO CLOUDY CUSTOM DAYLIGHT FLASH FLUORESCENT SHADE TUNGSTEN Lighting conditions that affect color balance. Set in CameraRAWOpenOptions. ZigZagType AROUNDCENTER OUTFROMCENTER PONDRIPPLES The method of zigzagging to use. Pass to ArtLayer.applyZigZag().
Appendix A: Event ID Codes The following table lists events and their four-character ID codes or string identifiers for use with the notifier object. Note: Do not include single quotes ( ' ) with four-character IDs in your code. The single quotes are used in this table to illustrate the placement of required spaces in codes that do not contain four letters. However, string identifiers, which are longer than four characters, require double quotes in the code.
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes 217 Event 4-char ID or String Charcoal 'Chrc' Chrome 'Chrm' Clear 'Cler' Close 'Cls ' Clouds 'Clds' ColorBalance 'ClrB' ColorHalftone 'ClrH' ColorRange 'ClrR' ColoredPencil 'ClrP' ContactSheet "0B71D221-F8CE-11d2-B21B-0008C75B322C" ConteCrayon 'CntC' Contract 'Cntc' ConvertMode 'CnvM' Copy 'copy' CopyEffects 'CpFX' CopyMerged 'CpyM' CopyToLayer 'CpTL' Craquelure 'Crql' CreateDroplet 'CrtD
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes 218 Event 4-char ID or String Deselect 'Dslc' Despeckle 'Dspc' DifferenceClouds 'DrfC' Diffuse 'Dfs ' DiffuseGlow 'DfsG' DisableLayerFX 'dlfx' Displace 'Dspl' Distribute 'Dstr' Draw 'Draw' DryBrush 'DryB' Duplicate 'Dplc' DustAndScratches 'DstS' Emboss 'Embs' Equalize 'Eqlz' Exchange 'Exch' Expand 'Expn' Export 'Expr' Jumpto 'Jpto' ExportTransparentImage "02879e00-cb66-11d1-bc43-0060b0a13
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes Event 4-char ID or String GaussianBlur 'GsnB' Get 'getd' Glass 'Gls ' GlowingEdges 'GlwE' Gradient 'Grdn' GradientMap 'GrMp' Grain 'Grn ' GraphicPen 'GraP' Group 'GrpL' Grow 'Grow' HalftoneScreen 'HlfS' Hide 'Hd HighPass 'HghP' HSBHSL 'HsbP' HueSaturation 'HStr' ImageSize 'ImgS' Import 'Impr' InkOutlines 'InkO' Intersect 'Intr' IntersectWith 'IntW' Inverse 'Invs' Invert 'Invr' LensF
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes 220 Event 4-char ID or String Mezzotint 'Mztn' Minimum 'Mnm ' ModeChange "8cba8cd6-cb66-11d1-bc43-0060b0a13dc4" Mosaic 'Msc ' Mosaic_PLUGIN 'MscT' MotionBlur 'MtnB' Move 'move' NTSCColors 'NTSC' NeonGlow 'NGlw' Next 'Nxt ' NotePaper 'NtPr' Notify 'Ntfy' Null typeNull OceanRipple 'OcnR' Offset 'Ofst' Open 'Opn ' Paint 'Pnt ' PaintDaubs 'PntD' PaletteKnife 'PltK' Paste 'past' PasteEffect
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes 221 Event 4-char ID or String PosterEdges 'PstE' Posterize 'Pstr' Previous 'Prvs' Print 'Prnt' ProfileToProfile 'PrfT' Purge 'Prge' Quit 'quit' RadialBlur 'RdlB' Rasterize 'Rstr' RasterizeTypeSheet 'RstT' RemoveBlackMatte 'RmvB' RemoveLayerMask 'RmvL' RemoveWhiteMatte 'RmvW' Rename 'Rnm ' ReplaceColor 'RplC' Reset 'Rset' ResizeImage "1333cf0c-cb67-11d1-bc43-0060b0a13dc4" Reticulation 'Rtcl'
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes Event 4-char ID or String Smooth 'Smth' SmudgeStick 'SmdS' Solarize 'Slrz' Spatter 'Spt ' Spherize 'Sphr' SplitChannels 'SplC' Sponge 'Spng' SprayedStrokes 'SprS' StainedGlass 'StnG' Stamp 'Stmp' Stop 'Stop' Stroke 'Strk' Subtract 'Sbtr' SubtractFrom 'SbtF' Sumie 'Smie' TakeMergedSnapshot 'TkMr' TakeSnapshot 'TkSn' TextureFill 'TxtF' Texturizer 'Txtz' Threshold 'Thrs' Tiles 'Tls ' Tor
Adobe Photoshop CS6 JavaScript Scripting Reference Appendix A: Event ID Codes Event 4-char ID or String WaterPaper 'WtrP' Watercolor 'Wtrc' Wave 'Wave' Wind 'Wnd ' ZigZag 'ZgZg' BackLight 'BacL' FillFlash 'FilE' ColorCast 'ColE' 223
Index A Action Manager 193 actions command lists 40 descriptions 43 descriptors 37 playing 47 active document 45 activePrinter 96 Add Noise filter adjustments brightness 55 color 197 color balance 55, 61 contrast 55, 59 curves 55 highlights 62 levels 55, 59 shadows 62 temperature 61 Adobe Illustrator, exporting paths to 105 alpha channels defined 72 from transparency (TIFF documents) 186 opacity 72 saving in BMP documents 69 in PDF documents 148 in PICT documents 153 in PICT resources 154 in Pixar documents
Adobe Photoshop CS6 JavaScript Scripting Reference canvas flipping 92 resizing 92 canvas, defined 88 caption 96 captions contact sheets 82 documents 99 gallery images 111 gallery thumbnails 115 images 99 centerCropMarks 96 channels activating 88 adding 74 adjusting 55 alpha See alpha channels creating 74 deleting 72 displaying in color 158 duplicating 72 making visible 72 merging 72 mixing 61 splitting 93 spot See spot channels types of 72 clipping paths from paths 139 from text 185 Clouds filter 55 CMYKCol
Adobe Photoshop CS6 JavaScript Scripting Reference Twirl 59 Wave 59 Zigzag 59 document formats, see individual document formats DocumentPrintSettings 96 documents 88 activating 45 adding 102 closing 90 code sample 94 color profiles 88 color samplers 88 counting items 89 counting objects 91 cropping 36, 91 dimensions 88 duplicating 36, 91 exporting 92 info 99 loading 48 managed 89 measurement scale 89 metadata 89, 99 open with Photoshop dialog 49 opening 49 optimizing for web 106 printing 92 resizing 92 reso
Adobe Photoshop CS6 JavaScript Scripting Reference color balance 55 histograms channels 72 history log 161 history states activating 88 allowing nonlinear 159 default number of 160 snapshot 120 suspending 93 HSBColor 122 hypenation 181 I IDs getting 37 PICT Resource 154 property 43 runtime 47 runtime to string 50 string to runtime 50 string to type 50 type to char 50 Illustrator See Adobe Illustrator image resizing 92 image pyramids 186 images bitmap 68 black and white 62 caches 159 captions 111 definition
Adobe Photoshop CS6 JavaScript Scripting Reference merging 60 merging visible 92 moving 61 rasterizing 92 rasterizing contents 61 removing 65 resizing 62 rotating 62 saving in PDF documents 148 unlinking 62 LayerSet 129 LayerSets 131 layersets merging 130 leading 181, 184 Lens Blur filter applying 57 Lens Flare filter 57 letter spacing 180–183 levels adjusting 55 adjusting automatically 55 ligatures 179–181 linked layers 60 unlinking 62 links colors 110 M MacOS filetypes 46 managed documents 89 mapBlack 96
Adobe Photoshop CS6 JavaScript Scripting Reference anchor points 143 left direction 143 right direction 143 PathItems 142 paths See path items PDF documents opening 147 saving 148 PDF presentations auto advance 162 making 48 output format 162 transition type 162 Photo CD discs, opening 151 photo filtering 61 photo galleries See galleries photomerge 48 Photoshop documents opening 207 saving 152 Photoshop files, maximizing compatibility 159 PICT documents opening 207 saving 153 PICT resources opening 207 savi
Adobe Photoshop CS6 JavaScript Scripting Reference scripts automation 189, 193 enabling/disabling in menu 189 executing 33 grouping in menu 189 installing 33 startup 33 terminology dictionary 193 valid file extensions 32 Scripts Events Manager 46 selected areas 90 selections 166 boundaries 166 clearing 166 copying 166 cutting 166 deselecting 166 feathering 166 filling 167 from paths 139 making work path from 167 resizing 166, 167 rotating 167 smoothing 168 stroking 168 selective color 62 SGIRGB documents sa
Adobe Photoshop CS6 JavaScript Scripting Reference ruler 160 type 161 UnitValue object 32, 187 Unsharp Mask filter 59 URLs, document 99 UTF8 Encoding 113 V vectorData 97 version application 47 scripting interface 46 video alpha 161 video filters De-Interlace 56 NTSC 58 visibility channels 72 layer comps 126 layers 54 Index W warp 184 Wave filter 59 Web photo galleries See galleries.