Arbortext Command Language > Using the Arbortext Command Language > Marking
  
Marking
Use the mark command to mark a string in the document (this string may include tags) for further processing. Marking (or highlighting) is a way to select, evaluate, or remove certain parts of a document. The mark begin command initiates a selection, starting highlighting at the cursor. The mark end command terminates the highlighting and causes the region to be selected. This region ranges from the place where the cursor was (where mark begin was executed) to the place where the mark end is issued. At this point, the variable $selection is equal to the content of this region and can thus be evaluated.
In the following example, the cursor is first moved to the top of the document. Then it is placed after the first chaphead it encounters and the beginning of the selection is marked. Then the cursor is placed before the end tag (note the –1 value to place it before the end tag rather than after it). Then the end is marked. The content of the chaphead tag pair is then assigned to the variable $title.
caret first,first
caret 0,"<chaphead>" -t
mark begin
caret 0,"</chaphead>"-1 -t
mark end
$title = $selection