User Guide

232 Chapter 14 Scripting the Visual Tools Object Model
LineCount
Syntax LineCount: integer (read-only
Description Number of lines in the active document.
Example
function Main() {
var sMessage;
sMessage = "Your file line count is: ";
with (Application) {
sMessage = sMessage + ActiveDocument.LineCount;
MessageBox(sMessage, VersionText, 0);
}
}
Lines
Syntax Lines(Index: integer) OleString
Description Gets and sets the text of the line at the passed index. Iterating through a document
using the Lines property might be slow, especially for large documents. For best
results, only use Lines to evaluate single lines of text. If you must use Lines to update
many lines, you can increase performance by wrapping the update in a
BeginUpdate..EndUpdate block.
Example
function Main(){
with (Application){
ActiveDocument.Lines(0) = ’<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN">’;
}
}
Modified
Syntax Modified: WordBool (read-only)
Description Boolean. Returns True if the document changed since it was last saved.
Example
function Main() {
var sMessage;
sMessage = "Modified : ";
with (Application) {
If(ActiveDocument.Modified)
sMessage = sMessage + "Yes";
Else
sMessage = sMessage + "No";