Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Language Guide / Part 2 - AppleScript Language Reference
Chapter 5 - Objects and References / Reference Forms


Filter

The Filter reference form specifies all objects in a container that match one or more conditions specified in a Boolean expression. The Filter reference form specifies application objects only. It cannot be used to specify values. (For information about how to use the Filter reference form, refer to the next section, "Using the Filter Reference Form," which begins on page 140.)

SYNTAX
referenceToObject ( whose | where ) Boolean 
where

referenceToObject is a reference that specifies one or more objects.

Boolean is any Boolean expression.

The words whose and where have the same meaning.

EXAMPLES
The following are some examples of references that use the Filter reference form. For examples with explanations, see the next section, "Using the Filter Reference Form," which begins on page 140.

every paragraph whose first word = last word
first word whose style contains italic
paragraph whose first word = last word
words whose style contains italic
every word whose size > 12 and font = "Palatino"
paragraphs where (count of characters) > 10
every word where it contains "ly"
every word where it � "the"
NOTES
Except for the Every Element reference form, the application returns an error
if no objects pass the test or tests. For the Every Element reference form, the application returns an empty list if no objects pass the test or tests.

To specify a container after a filter, you must enclose the filter and the
reference it applies to in parentheses. For example, the parentheses around
words 1 thru 5 whose first character = "M"
in the following reference are required because the container of paragraph 5 follows
the filter.

(words 1 thru 5 whose first character = "M") of paragraph 5 

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996