Adobe InDesign CS4 Scripting Tutorial
Scripting and the InDesign object model
11
Scripting and the InDesign object model
This section discusses the terminology of scripting languages in general and InDesign scripting in
particular.
Scripting terminology
This section discusses common scripting terms and concepts.
Comments
Comments give you a way to add descriptive text to a script. The scripting system ignores comments as
the script executes; this prevents comments from producing errors when you run your script. Comments
are useful to document the operation of a script (for yourself or someone else). In this document, we use
comments in the tutorial scripts.
To include a comment in an AppleScript, type
--
to the left of your comment or surround the comment
with
(*
and
*)
. In VBScript, type
Rem
(for “remark”) or
'
(a single straight quote) to the left of the comment.
Type the comment marker at the beginning of a line, to make the entire line a comment. In JavaScript, type
//
to the left of the comment, or surround the comment with
/*
and
*/
. For example:
AppleScript:
--this is a comment
(
* and so is this *
)
JavaScript:
// this is a comment
/* and so is this */
VBScript:
Rem this is a comment
' and so is this
Values
The point size of a character of text, the location of a text frame on a page, and the color of stroke of a
rectangle are examples of
values
used in InDesign scripting. Values are the data your scripts use to do their
work.
The
type
of a value defines what sort of data the value contains. For example, the value type of the
contents of a word is a text string, and the value type of the leading of a paragraph is a number. Usually,
the values used in scripts are numbers or text. The following table explains the value types most
commonly used in InDesign scripting: