Specifications

Table Of Contents
189
3
JavaScript Resource
This section describes the JavaScript resource that enables your JavaScripts to behave like a plug-in. This
includes:
the ability to specify a menu the script appears in as a command,
a terminology resource so the script can function with the Action Manager, which allows your script to
record and be automated by scripting parameters,
a category to enable ordering and grouping of commands within menus, and
an enable string that indicates whether the command is enabled or disabled given a set of conditions.
The strings must be valid XML syntax. The "&" character will not work for example. Use the &&
for example to get logical ‘
&&’ in the enableinfo block.
JavaScript resource syntax
The JavaScript Resource has an HTML-style syntax, with each <tag> matched by a closing </tag>. This
resource needs to appear within comments (
/* ... */) and should be defined at the top of your script
file (within the first 10,240 characters of the file.)
Tag Description
<javascriptresource>
The resource definition tag.
<name>
The command name that appears in the Photoshop menu.
If this tag is not provided in the resource, the name of the command in the
menu defaults to the name of the script.
<menu>
The menu the command appears in. If this tag is not provided, the
command appears in the File > Scripts menu.
Note: Currently the only supported values for
<menu> are automate,
filter
and help. automate puts the script in the File >
Automate menu for example.
<about>
A string that appears in an About box, which the user can select from the
Help > About Plug-in menu.
<enableinfo>
A boolean expression that indicates whether the command is enabled in
the menu. See Enable-info grammar
.
Note: If you provide this tag, the menu item is enabled if and only if there
is at least one document open, and the boolean expression
evaluates to true. If you always want the menu item enabled, do not
use this tag.
<eventid>
A unique string that identifies the event. Using a UUID will ensure that your
script wont share this identifier with another script.