Command: previous range
Returns a text range object relative to the specified selection or range.
Note If the text range is just after the specified unit, the text range is moved to the previous unit.
For example, if the selection is just after a word (before the trailing space), the following instruction
moves the selection backwards to the previous word.
set newSel to (previous range text object of selection by a word item count 1)
previous range text range Required. An expression that returns a text range object.
[by enumeration] Optional. Can be one of the following: a character item, a word item, a
sentence item, a paragraph item, a section 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 character item.
[count integer] Optional. The number of units by which you want to move back. The default
value is 1.
This example selects the paragraph that precedes the selection in the active document.
set newSel to previous range text object of selection by a paragraph item ¬
This example applies bold formatting to the first word in the active document.
set newSel to previous range word 2 of active document by a word item count 1
set bold of newSel to true
Command: previous subdocument
Moves the range or selection to the previous subdocument. If there isn't another subdocument, an
previous subdocument text range Required. An expression that returns a text range object.
This example switches the active document to master document view and selects the previous
if (count of subdocument in active document) 1 then
set view type of view of active window to master view
end key selection move unit a story extend by moving
select (previous subdocument text object of selection)