A SERVICE OF

logo

Adobe Version Cue CS3 Client Programmer’s Guide 27
Adobe Version Cue CS3 Client Programmer’s Guide
Scripting Environment
The JavaScript console is a key feature of the Toolkit. In addition to seeing trace output, you
can use its command line to execute lines of JavaScript, in the current execution context, and
also see directly the results of executing JavaScript in the output field.
A key feature of ExtendScript for debugging is the built-in dollar object, used as follows:
$.writeln(...);
A profiling tool is built into the ExtendScript toolkit, letting you identify hot spots in executing
your JavaScript code.
For details about the features offered by the Toolkit to develop, debug, and test JavaScript
code, see the JavaScript Tools Guide in the Adobe Bridge CS3 SDK.
Preprocessor Directives in ExtendScript
By default, ExtendScript supports the use of certain preprocessor directives and import direc-
tives, to enable you to compose a script by including script fragments. This is particularly use-
ful to write object-oriented JavaScript, and perhaps keep one class per file, as in the Java model.
For details about this ExtendScript feature, see the JavaScript Tools Guide in the Adobe Bridge
CS3 SDK.
This feature is not likely to work in a server-driven scripting environment.
Application and Version Specifiers
If you have scripting code you want to run only in a particular client application—for example,
if you only want some JavaScript code to execute in the context of Adobe Bridge CS3— the
recommended way to write this is as follows:
if(BridgeTalk.appName == 'bridge') {
// Continue with the Bridge-specific logic here
}
You also can use another static property of the BridgeTalk class to determine which version of
an application is installed:
if(BridgeTalk.getSpecifier == 'photoshop', 10) {
// Continue with logic that depends on Photoshop CS3 here
}
Adobe BridgeTalk is an inter-application communication framework that can be used for
scripting; it is described in the JavaScript Tools Guide in the Adobe Bridge CS3 SDK.
Writing Client-side Scripts for the First Time
Using the Version Cue Client Scripting Engine
The recommended way to develop JavaScript code for CS3 clients is to use the ExtendScript
Toolkit 2, which is bundled with Creative Suite CS3 or can be separately installed. In this sec-
tion, we examine two different ways to develop and test JavaScript code using the ExtendScript
To ol kit.