Writing and Executing Scripts in Visual Tools
To automate Visual Tools tasks, you must familiarize yourself with the Visual Tools
Object Model (VTOM). The main object is the Application object. The Application
object contains two important child objects, the ActiveDocument object and the
DocumentCache object. You can use these objects to write scripts for common tasks.
In addition, the Application object contains a number of toolbar-related functions,
which enable you to create toolbars dynamically.
For best performance, you should create an Application object variable and use it
throughout the script rather than continually referencing the Application object
directly.
For example, the following code creates an Application object variable in JScript:
function Main() {
The following code creates an Application object variable in VBScript:
Sub Main
Dim app
set app = Application 'create application object variable
app.WindowState = 2 'maximize the window
End Sub
The Application object is only available from scripts that are executed within the
Visual Tools.
To access the Application object from an external program, use the language's
equivalent of
Note
When writing and editing VTOM scripts and when porting code from VBScript,
remember that JScript is case-sensitive.
Executing scripts
If the scripting engine encounters an error while executing your custom script, the
script file opens in the editor with the error line highlighted. In addition, information
about the error displays in the status bar, which helps you debug the problem.
In the Customization dialog box, theKeyboard Shortcuts tab includes a shortcut
(Shift + Ctrl + Q) for the Execute current document as ActiveScript command.You can
use this command to pass the current document to the ActiveScripting engine,
which provides you with a tool for debugging your scripts. As with toolbutton-based
scripts, the scripting language is determined by the file extension of the current
document.
var app = Application; //create application object variable
app.WindowState = 2; //maximize the window
CreateObject("AllaireClientApp.TAllaireClientApp"
197
).
Need help?
Do you have a question about the COLDFUSION STUDIO 5-USING COLDFUSION 5 STUDIO and is the answer not in the manual?