Text Suite
445
Command: change end of range
Moves or extends the ending character position of a text range to the end of the nearest specified
text unit. This command returns a new text range.
Syntax
change end of range text range Required. An expression that returns a text range object.
[by enumeration] Optional. The unit by which to move the ending character position. Can be
one of the following: a character item, a word item, a sentence item, a paragraph item, a line
item, a story item, a screen, a section, a column, a row, a window, a cell, a character
formatting, a paragraph formatting, a table, or a item unit. The default value is a word item.
[extend type enumeration] Optional. Can be either of the following: by moving or by selecting.
If by moving is used, both ends of the text range are moved to the end of the specified unit. If
by selecting is used, the end of the text range is extended to the end of the specified unit. The
default value is by moving.
Remarks
If both the starting and ending positions for the text range are already at the end of the specified
unit, this command doesn't move or extend the text range.
Example
This example extends the selection to the end of the paragraph.
change end of range text object of selection by a paragraph item extend type ¬
by
selecting
This example moves
myRange
to the end of the first word in the selection (after the trailing space).
set myRange to character 1 of text object of selection
change end of range myRange by a word item extend type by moving
This example adds a table, selects the first cell in row two, and then extends the selection to the end
of the column.
set myRange to set range text object of active document start 0 end 0
set myTable to make new table at active document with properties ¬
{text object:myRange, number of rows:5, number of columns:3}
select (get cell from table myTable row 2 column 1)
change end of range text object of selection by a column extend type ¬
by
selecting