Language Guide

CHAPTER 4
Commands
Command Denitions 95
The result of the Count command depends on how you specify the range of
objects to be counted. For example, consider the following statement, given the
Scriptable Text Editor document in Figure 4-2:
tell document "simple" of app "Scriptable Text Editor"
count words from paragraph 2 to paragraph 3
end tell
--result: 8
Figure 4-2 The Scriptable Text Editor document “simple”
The reference words from paragraph 2 to paragraph 3 specifies a list
of the words in the second and third paragraphs:
{"This", "is", "paragraph", "two.",
"This", "is", "paragraph", "three."}
Each item in the list is a word. The Scriptable Text Editor counts the items in
the list and returns the result 8.
Sometimes the Count command returns a list of integers. Consider the
following statement:
tell document "simple" of app "Scriptable Text Editor"
count words of paragraphs 2 thru 3
end tell
--result: {4, 4}