User Guide

Application Object 217
Example function Main() {
Var sInput;
Var sOutput;
with (Application) {
sInput = InputBox(VersionText, "What is your name?", "Alex");
sOutput = "I know you, your name is " + sInput + ".";
MessageBox (sOutput, VersionText, 0);
}
}
NewDocument
Syntax NewDocument(wbUseDefaultTemplate: WordBool);
Description Boolean. Creates a new document, optionally from the default template.
Example function Main(){
with (Application){
NewDocument(true);
}
}
OpenFile
Syntax OpenFile(const wsFile: WideString): WordBool;
Description Boolean. Opens the passed file. Returns if the file opens or is already open. Passing
an empty string to
OpenFile displaysthe Open File dialog box, which enables the
user to select the files to open.
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);
}
}