User Guide

252 Chapter 15 Scripting the Visual Tools Object Model
Wait
Syntax Wait(nMilliseconds: Integer);
Description Pauses for given number of milliseconds. Use Wait to enable scripts to execute loops,
yet still allow access to the UI. Without the call to Wait in the loop, the application
appears locked and the user cannot change views.
Example The following JScript sample waits for the user to return to edit source view:
var app = Application;
while (app.CurrentView != 1) {
app.Wait(100);
}
This is the same sample code in VBScript:
set app = Application
while app.CurrentView 1
app.Wait (100)
wend
Toolbar and toolbutton methods
This section describes the toolbar manipulation methods available in the
Application object.
A unique name identifies each toolbar. The name of the toolbar displays in the title
bar caption when the toolbar is not docked. Toolbars are loaded from files in the
toolbar directory, which can be obtained from the
ToolbarDir property. The toolbar
name is the same as its filename without the path or extension. For example, if the
toolbar filename is Custom.tbr, then the toolbar name is Custom.
When you create a toolbutton, remember that a toolbutton label is limited to two
characters.
AddAppToolbutton
Syntax AddAppToolbutton(wsToolbarName, wsExeFile, wsCmdLine, wsHint: Wide-
String): WordBool;
Description Boolean. Adds a toolbutton for an external application to the passed toolbar. Fails if
the toolbar does not exist or if the toolbutton could not be added. Returns True if the
same toolbutton (based on wsExeFile and wsCmdLine) already exists on the toolbar,
but does not add a duplicate toolbutton.
Example
function Main(){
with (Application){
AddAppToolbutton('Standard', 'Notepad.exe', '', 'NotePad');
}
}