Language Guide
CHAPTER 4
Commands
Command Definitions 93
pluralClassName
The plural class name of the elements to be counted. The
elements of lists, records, and strings are listed in the value
class definitions in Chapter 3, “Values.”
Class: Class identifier
Default value: Item for lists, records, and application objects;
Character for strings (see “Notes”)
referenceToObject
A reference to the object or objects whose elements are to be
counted. If you do not specify this parameter, the application
counts the elements in the default target of the Tell statement.
Class: List, record, reference, or string
RESULT
The result of the AppleScript command is an integer that specifies the number
of elements of a specified class in a compound value.
The result of the application command is either an integer or a list of integers.
See “Notes” for details.
Class: Integer or list of integers
EXAMPLES
In the following example, compoundValue is a list. The command does not
explicitly specify a class of elements to count, so AppleScript counts all the
items in the list.
count {"Yes", "No", "Maybe", 4, 5, 6}
--result: 6
In this example, className is integers and referenceToObject is a list of strings
and integers. AppleScript counts the integers in the list.
count integers in {"Yes", "No", "Maybe", 4, 5, 6}
--result: 3