Specifications

Table Of Contents
Adobe Photoshop CS6
JavaScript Scripting Reference JavaScript Resource 193
Using the "in" function
The in function (see <inFunction>) 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. For example:
in(PSHOP_ImageMode, RGBMode, CMYKMode, LabMode)
Action Manager automation
For your script to be able to record scripting parameters and be automated by them, it requires the
addition of two basic mechanisms:
A terminology dictionary that maps your script’s user interface to human readable text, providing text
and type information for each parameter the script uses.
Code to read parameter information when it comes from the Action Manager, rather than from the
user-interface, and code to write parameter information to the Action Manger. This code uses the
Action Manager classes ActionDescriptor
, ActionList, and ActionReference.
See
Conditional Mode Change.jsx for an example of a script that can record and be automated by
scripting parameters. This file can be found in the Presets/Scripts folder.
Terminology dictionary
The JavaScript resource provides a <terminology> tag that allows you to provide the terminology
dictionary for your script. The first step in creating a terminology dictionary is to review your script’s user
interface, and create human-readable strings for each element in your user interface.
For example, in the Conditional Mode Change command, the user interface requests a source mode and a
target mode. Both source mode and target mode have several options. All of these elements of the user
interface need to have entries in the terminology dictionary.
The terminology dictionary is created in a PDF dictionary format, with the following entries, and must have
the following format in the
<javascriptresource>:
<terminology><![CDATA[<<<
/Version integer
/Events <<event dictionary>>
/Classes <<class dictionary>>
/Enumerations <<enumeration dictionary>>
>>> ]]></terminology>
Note: The information in the terminology tag needs to be wrapped in a CDATA block so the xml parser will
ignore "/" and other tags that appear in the terminology.
The defintions for events, classes and enumerations dictionaries are provided below.