User Guide

234 Chapter 14 Scripting the Visual Tools Object Model
SelText
Syntax SelText: OleString
Description Gets and sets the text in the current selection.
Example
function Main() {
var sMessage;
sMessage = "The length of the selected text of your document is ";
with (Application) {
sMessage = sMessage + ActiveDocument.SelText;
MessageBox(sMessage, VersionText, 0);
}
}
TabIndex
Syntax TabIndex
Description Gets and sets the tab index of the document tab.
Example
function Main(){
with (Application){
if (ActiveDocument.TabIndex != 0){
DocumentIndex = 0;
}
}
}
Text
Syntax Text: OleString
Description Gets and sets the complete document text.
Methods
BeginUpdate
Syntax BeginUpdate();
Description Turns off screen updating for the active document. This is useful if your script needs
to make several changes to the active document at once—turning off screen
updating during the procedure might significantly speed up the process. To turn on
updating again, use
EndUpdate.
Use
BeginUpdate...EndUpdate with caution. If you fail to call EndUpdate after a call
to
BeginUpdate, or if the script crashes before EndUpdate is called, the user cannot
view any changes made in the editor.