Language Guide

CHAPTER 5
Objects and References
Reference Forms 133
The following example contains two references. The first is a reference to the
tenth word of the document called Introduction. The second is a reference to
the last insertion point in the same document.
tell application "Scriptable Text Editor"
move word 10 of document "Introduction" to
end of document "Introduction"
end tell
Middle Element 5
The Middle Element reference form specifies the middle object of a particular
class in a container.
SYNTAX
middle className
where
className is the class identifier for the specified object.
EXAMPLES
middle word of paragraph 1
middle item of {1, "doughnut", 33}
NOTES
AppleScript calculates the middle object with the expression ((n + 1) div
2), where n is the number of objects and div is the integer division operator. If
there is an even number of objects in the container, the result is rounded down.
For example, the middle word of a paragraph containing twenty words is the
tenth word.