Adobe Photoshop CS5 Object Library JS: Application

Photoshop CS5

Class

Application

 

The Adobe Photoshop application object.

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;

QuickLinks

batch, beep, bringToFront, charIDToTypeID, doAction, eraseCustomOptions, executeAction, executeActionGet, featureEnabled, getCustomOptions, load, makeContactSheet, makePDFPresentation, makePhotoGallery, makePhotomerge, makePicturePackage, open, openDialog, purge, putCustomOptions, refresh, runMenuItem, stringIDToTypeID, togglePalettes, typeIDToCharID, typeIDToStringID

Hierarchy

Object
Application

Properties

PropertyTypeAccessDescription
activeDocumentDocument r/wThe frontmost document.
backgroundColorSolidColor r/wThe default background color (used to paint, fill, and stroke selections).
buildstring readonlyThe build number.
colorSettingsany r/wThe name of the selected color setting's set.
displayDialogsDialogModes:
DialogModes.ALL
DialogModes.ERROR
DialogModes.NO
r/wThe dialog mode for the document, which indicates whether or not Photoshop displays dialogs when the script runs.
documentsDocuments Document readonlyThe collection of open documents.
fontsTextFonts TextFont readonlyThe fonts installed on this system.
foregroundColorSolidColor r/wThe default foreground color (used to paint, fill, and stroke selections).
freeMemorynumber readonlyThe amount of unused memory available to Photoshop.
localestring readonlyThe language locale of the application.
macintoshFileTypes Array of string readonlyA list of the image file types Photoshop can open.
measurementLogMeasurementLog readonlyThe log of measurements taken.
namestring readonlyThe application name.
notifiersNotifiers Notifier readonlyThe notifiers currently configured (in the Scripts Events Manager menu in the application).
notifiersEnabledbool r/wIf true, notifiers are enabled.
parentObject readonlyThe object's container.
pathFolder readonlyThe full path of the location of the Adobe Photoshop application.
playbackDisplayDialogsDialogModes:
DialogModes.ALL
DialogModes.ERROR
DialogModes.NO
r/wThe dialog mode for playback mode, which indicates whether or not Photoshop displays dialogs in playback mode.
playbackParametersActionDescriptor r/wThe playback options, which indicate the speed at which Photoshop plays actions.
preferencesPreferences readonlyThe application preference settings (equivalent to selecting Edit > Preferences in the Adobe Photoshop application in Windows or Photoshop > Preferences in Mac OS).
preferencesFolderFile readonlyThe full path to the preferences folder.
recentFilesFileArray readonlyFiles in the Recent Files list.
scriptingBuildDatestring readonlyThe build date of the scripting interface.
scriptingVersionstring readonlyThe version of the Scripting interface.
systemInformationstring readonlyThe system and applicaiton information.
typenamestring readonlyThe class name of the object.
versionstring readonlyThe version of Adobe Photoshop application that you are running.
windowsFileTypes Array of string readonlyA list of the image file extensions Photoshop can open.

Methods

Instances

string batch (inputFiles: AliasArray, action: string, from: string[, options: BatchOptions])
Runs the batch automation routine; analogous to using the Batch command in Photoshop.

ParameterTypeDescription
inputFilesAliasArrayThe files to operate on.
actionstringThe name of the action to play (note that the Action name is case-sensitive and must match the name in the Actions palette).
fromstringThe 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).
optionsBatchOptionsOptions for batch automation. (Optional)

void beep ()
Alerts the user.

void bringToFront ()
Makes Photoshop the active application.

int charIDToTypeID (charID: string)
Converts from a four character code to a runtime ID.

ParameterTypeDescription
charIDstringThe ID to convert.

void doAction (action: string, from: string)
Plays the specified action from the Actions palette.

ParameterTypeDescription
actionstringThe 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.)
fromstringThe 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.)

void eraseCustomOptions (key: string)
Removes the specified user objects from the Photoshop registry.

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

ActionDescriptor executeAction (eventID: int[, descriptor: ActionDescriptor][, displayDialogs: DialogModes])
Plays an ActionManager event.

ParameterTypeDescription
eventIDintThe event to play.
descriptorActionDescriptorThe action descriptor to play. (Optional)
displayDialogsDialogModes:
DialogModes.ALL
DialogModes.ERROR
DialogModes.NO
The display permissions for dialogs and alert messages. (Optional)

ActionDescriptor executeActionGet (reference: ActionReference)
Obtains an action descriptor.

ParameterTypeDescription
referenceActionReferenceThe reference specification of the property.

bool featureEnabled (name: string)
If true, the specified feature is enabled.

ParameterTypeDescription
namestringThe name of the feature.

ActionDescriptor getCustomOptions (key: string)
Retrieves user objects from the Photoshop registry for the ID with value key.

ParameterTypeDescription
keystringThe unique string ID for the user object.

void load (document: File)
Loads a support document.

ParameterTypeDescription
documentFileThe document to load.

string makeContactSheet (inputFiles: AliasArray[, options: ContactSheetOptions])
Creates a contact sheet from multiple files.

ParameterTypeDescription
inputFilesAliasArrayThe files to include.
optionsContactSheetOptionsOptions for creating the contact sheet. (Optional)

string makePDFPresentation (inputFiles: AliasArray, outputFile: File[, options: PresentationOptions])
Creates a PDF presentation file.

ParameterTypeDescription
inputFilesAliasArrayThe input files to include in the presentation.
outputFileFileThe location of the output file.
optionsPresentationOptionsOptions for the PDF presentation. (Optional)

string makePhotoGallery (inputFolder: any, outputFolder: File[, options: GalleryOptions])
Deprecated for Adobe Photoshop CS3. Creates a web photo gallery.

ParameterTypeDescription
inputFolder any Folder to process or an array of files to process.
outputFolderFileLocation for output files.
optionsGalleryOptionsOptions for the web photo gallery. (Optional)

string makePhotomerge (inputFiles: AliasArray)
Deprecated for Adobe Photoshop CS3. Merges multiple files into one, user interaction required.

ParameterTypeDescription
inputFilesAliasArrayList of input files to include.

string makePicturePackage (inputFiles: AliasArray[, options: PicturePackageOptions])
Creates a picture package from multiple files.

ParameterTypeDescription
inputFilesAliasArrayThe files to include.
optionsPicturePackageOptionsOptions for creating a Picture Package. (Optional)

Document open (document: File[, as: any][, asSmartObject: bool=false])
Opens the specified document file(s).

ParameterTypeDescription
documentFileThe document(s) to opend.
as any The document type (The default is to let Photoshop deduce the format). (Optional)
asSmartObjectboolCreates a smart object around the document. (default: false) (Optional)

FileArray openDialog ()
Uses the Photoshop open dialog to select files.

void purge (target: PurgeTarget)
Purges one or more caches.

ParameterTypeDescription
targetPurgeTarget:
PurgeTarget.UNDOCACHES
PurgeTarget.HISTORYCACHES
PurgeTarget.CLIPBOARDCACHE
PurgeTarget.ALLCACHES
The caches to purge.

void putCustomOptions (key: string, customObject: ActionDescriptor[, persistent: bool=true])
Saves user objects in the Photoshop registry.

ParameterTypeDescription
keystringThe unique string ID for the user object.
customObjectActionDescriptorThe user-defined custom object to save in the registry.
persistentboolIf true, the object persists after the script has finished. (default: true) (Optional)

void refresh ()
Pauses the script until the application refreshes.

int runMenuItem ()
Run a menu item with the given ID. Use this for Insert Menu Item.

int stringIDToTypeID (stringID: string)
Converts from a string ID to a runtime ID.

ParameterTypeDescription
stringIDstringThe ID to convert.

void togglePalettes ()
Toggle palette visibility.

string typeIDToCharID (typeID: int)
Converts from a runtime ID to a character ID.

ParameterTypeDescription
typeIDintThe ID to convert.

string typeIDToStringID (typeID: int)
Converts from a runtime ID to a string ID.

ParameterTypeDescription
typeIDintThe ID to convert.

Element of

global.app

Jongware, 28-Aug-2012 v3.0.3iContents :: Index