User Guide

246 Chapter 15 Scripting the Visual Tools Object Model
When using this method in JScript, you must escape backslashes inside a string. For
example, in Application.OpenFile("C:\\Documents\\MyFile.htm"); each
backslash is preceded by an additional backlash.
Example
function Main() {
Var sFile;
Var bResult;
sFile = "C:\\Temp\myDoc.txt"
with (Application) {
If(OpenFile(sFile))
MessageBox("File opened successfuly.", VersionText);
Else
MessageBox("File does not exist or already open.", VersionText);
}
}
PreviousDoc
Syntax PreviousDoc();
Description Moves to the previous document in the Document tab. If the first document is
showing, wraps to the last.
Example
function Main(){
with (Application){
// Create a new blank document
NewDocument(false);
// Move back to previous file
PreviousDoc();
}
}
Quit
Syntax Quit();
Description Attempts to exit from or quit the program. Prompts the user to save any unsaved
documents prior to quitting.
Example
function Main(){
var MB_YESNO = 4;
var IDYES = 6;
with (Application){
if (MessageBox('Exit HomeSite?', 'Confirmation Message',
MB_YESNO) == 6){
Quit();
}
}
}