Application

The Adobe Photoshop application object, which contains all other Adobe Photoshop objects.

This is the root of the object model, and provides access to all other objects. To access the properties and methods, you can use the pre-defined global variable app. For example: var currentDoc = app.activeDocument;

Methods:

toolSupportsBrushes, saveToolBrushToFile, applyToolBrushFromFile, thumbnailStyleFile, thumbnailText, doProgress, doForcedProgress, changeProgressText, doProgressTask, doProgressSegmentTask, doProgressSubTask, updateProgress, togglePalettes, doAction, load, open, purge, makePhotoGallery, makePDFPresentation, makePhotomerge, makeContactSheet, makePicturePackage, batch, bringToFront, refresh, refreshFonts, putCustomOptions, getCustomOptions, eraseCustomOptions, featureEnabled, openDialog, runMenuItem, system, executeAction, executeActionGet, stringIDToTypeID, typeIDToStringID, charIDToTypeID, typeIDToCharID, beep, isQuicktimeAvailable, showColorPicker

Objects:

ActionDescriptor, Boolean, DialogModes, Document, Documents, File, MeasurementLog, Notifiers, Number, Preferences, SolidColor, String, TextFonts,

Preferences:

Preferences

Property Listing

Property

Type

Access

Description

activeDocument

Document

read/write

The frontmost document.

backgroundColor

SolidColor

read/write

The default background color (used to paint, fill, and stroke selections).

build

String

readonly

The build number of Adobe Photoshop application.

colorSettings

Varies

read/write

The name of the selected color setting's set.

currentTool

String

read/write

Name of the current tool.

displayDialogs

DialogModes

DialogModes.ALL

DialogModes.ERROR

DialogModes.NO

read/write

The dialog mode for the document, which indicates whether or not Photoshop displays dialogs when the script runs.

documents

Documents Document

readonly

The collection of open documents.

fonts

TextFonts TextFont

readonly

The fonts installed on this system.

foregroundColor

SolidColor

read/write

The default foreground color (used to paint, fill, and stroke selections).

freeMemory

Number

readonly

The amount of unused memory available to Photoshop.

locale

String

readonly

The language locale of the application.

macintoshFileTypes

Array of String

readonly

A list of the image file types Photoshop can open.

measurementLog

MeasurementLog

readonly

The log of measurements taken.

name

String

readonly

The application name.

notifiers

Notifiers Notifier

readonly

The notifiers currently configured (in the Scripts Events Manager menu in the application).

notifiersEnabled

Boolean

read/write

If true, notifiers are enabled.

parent

 

readonly

The object's container.

path

File

readonly

The full path of the location of the Adobe Photoshop application.

playbackDisplayDialogs

DialogModes

DialogModes.ALL

DialogModes.ERROR

DialogModes.NO

read/write

The dialog mode for playback mode, which indicates whether or not Photoshop displays dialogs in playback mode.

playbackParameters

ActionDescriptor

read/write

The playback options, which indicate the speed at which Photoshop plays actions.

preferences

Preferences

readonly

The application preference settings (equivalent to selecting Edit > Preferences in the Adobe Photoshop application in Windows or Photoshop > Preferences in Mac OS).

preferencesFolder

File

readonly

The full path to the preferences folder.

recentFiles

FileArray

readonly

Files in the Recent Files list.

scriptingBuildDate

String

readonly

The build date of the scripting interface.

scriptingVersion

String

readonly

The version of the Scripting interface.

systemInformation

String

readonly

System information of the host application and machine.

typename

String

readonly

The class name of the object.

version

String

readonly

The version of Adobe Photoshop application that you are running.

windowsFileTypes

Array of String

readonly

A list of the image file extensions Photoshop can open.

Method Listing

undefined applyToolBrushFromFile (file:File)

PRIVATE - set the current tool brush from a file.

Parameter

Type

Description

file

File

Brush file to apply.

String batch (inputFiles:AliasArray, action:String, from:String, [options:BatchOptions])

Runs the batch automation routine; analogous to using the Batch command in Photoshop.

Parameter

Type

Description

inputFiles

AliasArray

The files to operate on.

action

String

The name of the action to play (note that the Action name is case-sensitive and must match the name in the Actions palette).

from

String

The name of the action set containing the action being played (note that the Action Set name is case-sensitive and must match the name in the Actions palette).

options

BatchOptions

Options for batch automation.

undefined beep ()

Alerts the user.

undefined bringToFront ()

Makes Photoshop the active application.

undefined changeProgressText (progressString:String)

Changes the text that appears in the progress window.

Parameter

Type

Description

progressString

String

String to show in the progress window.

Int charIDToTypeID (charID:String)

Converts from a four character code to a runtime ID.

Parameter

Type

Description

charID

String

The ID to convert.

undefined doAction (action:String, from:String)

Plays the specified action from the Actions palette.

Parameter

Type

Description

action

String

The name of the action to play. (Note that the action name is case-sensitive and must match the name as it appears in the Actions palette.)

from

String

The name of the action set containing the action being played. (Note that the Action Set name is case-sensitive and must match the name as it appears in the Actions palette.)

undefined doForcedProgress (progressString:String, javaScriptString:String)

Performs a task with a progress bar. Forces progress bar to display, ignoring the normal heuristics that keep it from showing unnecessarily (e.g. during very short tasks). Other progress APIs must be called periodically to update the progress bar and allow cancelling.

Parameter

Type

Description

progressString

String

String to show in the progress window.

javaScriptString

String

JavaScriptString to execute.

undefined doProgress (progressString:String, javaScriptString:String)

Performs a task with a progress bar. Other progress APIs must be called periodically to update the progress bar and allow cancelling.

Parameter

Type

Description

progressString

String

String to show in the progress window.

javaScriptString

String

JavaScriptString to execute.

Boolean doProgressSegmentTask (segmentLength:Int, done:Int, total:Int, javaScriptString:String)

Sections off a portion of the unused progress bar for execution of a subtask. Returns false on cancel. Use when iterating a list of tasks with unequal run times.

Parameter

Type

Description

segmentLength

Int

The length of the current task.

done

Int

The total length of all completed tasks.

total

Int

The total length of all tasks.

javaScriptString

String

JavaScriptString to execute.

Boolean doProgressSubTask (index:Int, limit:Int, javaScriptString:String)

Sections off a portion of the unused progress bar for execution of a subtask. Returns false on cancel. Use when iterating a simple list of tasks with equal run times.

Parameter

Type

Description

index

Int

The 0-based index of the current task.

limit

Int

The total number of tasks.

javaScriptString

String

JavaScriptString to execute.

Boolean doProgressTask (taskLength:Number, javaScriptString:String)

Sections off a portion of the unused progress bar for execution of a subtask. Returns false on cancel.

Parameter

Type

Description

taskLength

Number

Amount of the unused progress bar to section off, between 0.0 and 1.0.

javaScriptString

String

JavaScriptString to execute.

undefined eraseCustomOptions (key:String)

Removes the specified user objects from the Photoshop registry.

Parameter

Type

Description

key

String

The unique string ID for user object(s) to remove.

ActionDescriptor executeAction (eventID:Int, [descriptor:ActionDescriptor], [displayDialogs:DialogModes])

Plays an ActionManager event.

Parameter

Type

Description

eventID

Int

The event to play.

descriptor

ActionDescriptor

The action descriptor to play.

displayDialogs

DialogModes

DialogModes.ALL

DialogModes.ERROR

DialogModes.NO

The display permissions for dialogs and alert messages.

ActionDescriptor executeActionGet (reference:ActionReference)

Obtains an action descriptor.

Parameter

Type

Description

reference

ActionReference

The reference specification of the property.

Boolean featureEnabled (name:String)

If true, the specified feature is enabled.

Parameter

Type

Description

name

String

The name of the feature.

ActionDescriptor getCustomOptions (key:String)

Retrieves user objects from the Photoshop registry for the ID with value key.

Parameter

Type

Description

key

String

The unique string ID for the user object.

Boolean isQuicktimeAvailable ()

Returns true if Quicktime is installed.

undefined load (document:File)

Loads a support document.

Parameter

Type

Description

document

File

The document to load.

String makeContactSheet (inputFiles:AliasArray, [options:ContactSheetOptions])

Creates a contact sheet from multiple files.

Parameter

Type

Description

inputFiles

AliasArray

The files to include.

options

ContactSheetOptions

Options for creating the contact sheet.

String makePDFPresentation (inputFiles:AliasArray, outputFile:File, [options:PresentationOptions])

Creates a PDF presentation file.

Parameter

Type

Description

inputFiles

AliasArray

The input files to include in the presentation.

outputFile

File

The location of the output file.

options

PresentationOptions

Options for the PDF presentation.

String makePhotoGallery (inputFolder:Varies, outputFolder:File, [options:GalleryOptions])

DEPRECATED. Creates a web photo gallery.

Parameter

Type

Description

inputFolder

Varies

Folder to process or an array of files to process.

outputFolder

File

Location for output files.

options

GalleryOptions

Options for the web photo gallery.

String makePhotomerge (inputFiles:AliasArray)

DEPRECATED. Merges multiple files into one, user interaction required.

Parameter

Type

Description

inputFiles

AliasArray

List of input files to include.

String makePicturePackage (inputFiles:AliasArray, [options:PicturePackageOptions])

Creates a picture package from multiple files.

Parameter

Type

Description

inputFiles

AliasArray

The files to include.

options

PicturePackageOptions

Options for creating a Picture Package.

Document open (document:File, [as:Varies], [asSmartObject:Boolean=Boolean])

Opens the specified document file(s).

Parameter

Type

Description

document

File

The document(s) to opend.

as

Varies

The document type (The default is to let Photoshop deduce the format).

asSmartObject

Boolean

Creates a smart object around the document.

(default: false)

FileArray openDialog ()

Uses the Photoshop open dialog to select files.

undefined purge (target:PurgeTarget)

Purges one or more caches.

Parameter

Type

Description

target

PurgeTarget

PurgeTarget.UNDOCACHES

PurgeTarget.HISTORYCACHES

PurgeTarget.CLIPBOARDCACHE

PurgeTarget.ALLCACHES

The caches to purge.

undefined putCustomOptions (key:String, customObject:ActionDescriptor, [persistent:Boolean=Boolean])

Save user objects in the Photoshop registry.

Parameter

Type

Description

key

String

The unique string ID for the user object.

customObject

ActionDescriptor

The user-defined custom object to save in the registry.

persistent

Boolean

If true, the object persists after the script has finished.

(default: true)

undefined refresh ()

Pauses the script until the application refreshes.

undefined refreshFonts ()

Force the font list to get refreshed.

undefined runMenuItem (menuID:Int)

Run a menu item.

Parameter

Type

Description

menuID

Int

Id of menu to run.

undefined saveToolBrushToFile (file:File)

PRIVATE - save the current tool brush to a file.

Parameter

Type

Description

file

File

File to save the brush to.

Boolean showColorPicker ([pickForeground:Boolean=Boolean])

Display color picker dialog. Returns false if dialog is cancelled, true otherwise.

Parameter

Type

Description

pickForeground

Boolean

If true the foreground color is chosen, if false the background color is chosen.

(default: true)

Int stringIDToTypeID (stringID:String)

Converts from a string ID to a runtime ID.

Parameter

Type

Description

stringID

String

The ID to convert.

Int system (callString:String)

Perform a system call.

Parameter

Type

Description

callString

String

System call string.

undefined thumbnailStyleFile (file:File, dest:File, [thumbnailSize:Int], [backgroundValue:Number])

PRIVATE - write out a thumbnail file from a style file.

Parameter

Type

Description

file

File

Style file to read.

dest

File

Thumb file to write.

thumbnailSize

Int

Size of thumbnail to save.

backgroundValue

Number

Background grayvalue.

undefined thumbnailText (dest:File, [text:String], [font:String], [size:Int], [color:SolidColor])

PRIVATE - write out a thumbnail file from text parameters.

Parameter

Type

Description

dest

File

Thumb file to write.

text

String

Text to render.

font

String

PostScript name of font.

size

Int

Size of type.

color

SolidColor

Color of type.

undefined togglePalettes ()

Toggle palette visibility.

Boolean toolSupportsBrushes (tool:String)

Check if the specified tool supports brushes.

Parameter

Type

Description

tool

String

The name of the tool to check.

String typeIDToCharID (typeID:Int)

Converts from a runtime ID to a character ID.

Parameter

Type

Description

typeID

Int

The ID to convert.

String typeIDToStringID (typeID:Int)

Converts from a runtime ID to a string ID.

Parameter

Type

Description

typeID

Int

The ID to convert.

Boolean updateProgress (done:Int, total:Int)

Updates the progress bar started by doProgress. Use for manual non-task based progress updating. Returns false on cancel.

Parameter

Type

Description

done

Int

The number of tasks completed.

total

Int

The total number of tasks.