Specifications

Table Of Contents
Adobe Photoshop CS6
JavaScript Scripting Reference JavaScript Resource 190
Basic JavaScript resource example
This example shows a very basic <javascriptresource>. With this resource, the script can be executed
by selecting the command Add a Document, which appears in the Automate menu. This command is
enabled in the menu, provided at least one document is already open. If the user requests information
about the script from the About Plug-in menu, the string contained in the
<about> tag is displayed in a
dialog box.
/*
<javascriptresource>
<name>Add a Document</name>
<type>automate</type>
<about>A short string providing information about the script.</about>
<enableinfo>true</enableinfo>
</javascriptresource>
*/
app.documents.add();
Enable-info grammar
The <enableinfo> tag provides a boolean expression that, when evaluated, indicates whether the
command is enabled in the menu. You can use this expression to enable or disable the menu item based
on various characteristics of the document. The Enable Info grammar is as follows:
<category>
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
<category>. If two commands use
the same category, they are grouped together.
<terminology>
The terminology dictionary for the script to function with the Action
Manager. See the Terminology dictionary
.
Tag Description
<booleanExpression> := <conjunction> { "||" <conjunction> }
<conjunction> := <relation> {"&&" <relation> }
<relation> := <equality> {<relationOperator><equality>}
<equality> := <simpleExpression> {<equalityOperator><simpleExpression>}
<simpleExpression> := <term> {<addOperator><term>}
<term> := <factor> {<mulOperator><factor>}
<factor> := <integer> | <intrinsic> | <ident> |
"(" <booleanExpression ")" | "(" simpleExpression ")" |
"+" <factor> | "-" <factor> | "!" <factor>
<integer> := digit {digit}
<intrinsic> := <limitFunction> | <dimFunction> | <inFunction>
<limitFunction> := ( "min" | "max") "(" <simpleExpression> ","
<simpleExpression> { "," <simpleExpression> } ")"
<dimFunction> := "dim" "(" <simpleExpression> "," <simpleExpression> ")"