Language Guide

CHAPTER 4
Commands
92 Command Denitions
Count AppleScript command, application command4
The Count command can function as an AppleScript command or an
application command. The AppleScript command counts the number of
elements of a particular class in a list, record, or string. The application
command counts the number of elements of a particular class in an object
or objects.
APPLESCRIPT COMMAND SYNTAX
count [ [ each | every ] className ( in | of ) ] compoundValue
number of [ pluralClassName ( in | of ) ] compoundValue
APPLICATION COMMAND SYNTAX
count [ each | every ] className [ ( in | of ) referenceToObject ]
number of className [ ( in | of ) referenceToObject ]
PARAMETERS
className The class name of the elements to be counted. If you use the
term each or every, you can use only the singular form of the
class name. The elements of lists, records, and strings are listed
in the value class definitions in Chapter 3, “Values.” The
elements of application objects are listed in their object class
definitions in the application dictionary.
Class: Class identifier
Default value: Item for lists, records, and application objects;
Character for strings (see “Notes”)
compoundValue
An expression that evaluates to a compound value whose
elements are to be counted.
Class: List, record, reference, or string