Bridge JavaScript Guide for Windows® and Macintosh®.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or
electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior written consent of Adobe Systems Incorporated. The software described in this document is furnished under
license and may only be used or copied in accordance with the terms of such license.
This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or
inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and
all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights.
Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual
organization.
Adobe, the Adobe logo, Illustrator, Photoshop, InDesign, and Version Cue are either registered trademarks or trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Apple, Mac, Macintosh, and Mac OS are trademarks of Apple Inc., registered in the United States and other countries. Microsoft, and
Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. JavaScript and all
Java-related marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a
registered trademark of The Open Group.
All other trademarks are the property of their respective owners.
If this guide is distributed with software that includes an end user agreement, this guide, as well as the software described in it, is furnished
under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part
of this guide may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording,
or otherwise, without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected
under copyright law even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or
inaccuracies that may appear in the informational content contained in this guide.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
About This Book.............................................................................................................................................................................. 6
Who should read this book .................................................................................................................................................. 6
What is in this book................................................................................................................................................................. 7
Where to go for more information .................................................................................................................................... 7
Documentation and sample code ..................................................................................................................................... 9
Executing scripts for Adobe Bridge.................................................................................................................................10
The Adobe Bridge Browser Window and Object Model ................................................................................................10
The Adobe Bridge browser window ...............................................................................................................................11
Accessing the Adobe Bridge browser through scripts.............................................................................................12
The Adobe Bridge Object Model ..........................................................................................................................................14
The application and documents ................................................................................................................................15
Thumbnails in documents............................................................................................................................................15
Customizing the user interface.........................................................................................................................................17
Customizing the browser window ............................................................................................................................17
Communicating with the user from a script..........................................................................................................19
2Interacting with Adobe Bridge through Scripts...................................................................... 23
Accessing Thumbnails with Scripts .......................................................................................................................................23
Thumbnails as node references........................................................................................................................................23
Using and accessing thumbnails......................................................................................................................................24
Accessing many thumbnails correctly .....................................................................................................................24
Metadata for thumbnails.....................................................................................................................................................25
Embedding metadata in a script as XML.......................................................................................................................26
Event Handling in Adobe Bridge ............................................................................................................................................27
Communicating with Other Applications ...........................................................................................................................28
3Creating a User Interface for a Script .......................................................................................30
User Interface Options for Scripts...........................................................................................................................................30
Displaying ScriptUI in Adobe Bridge.....................................................................................................................................32
Displaying ScriptUI elements in a navigation bar......................................................................................................33
Displaying ScriptUI elements in a custom palette.....................................................................................................33
Displaying HTML in Adobe Bridge.........................................................................................................................................34
Defining callbacks for HTML scripts ................................................................................................................................34
Executing script functions defined on HTML UI pages ............................................................................................35
Displaying HTML in Adobe Bridge dialogs ...................................................................................................................36
Communicating with Adobe Bridge from dialog JavaScript .................................................................................36
Using callbacks in an HTML dialog ..................................................................................................................................37
Calling functions defined in an HTML dialog ........................................................................................................37
Displaying HTML in a navigation bar..............................................................................................................................37
Calling functions defined in an HTML navigation bar........................................................................................37
Displaying HTML in a custom palette.............................................................................................................................38
Passing Complex Values in Remote Calls ............................................................................................................................38
Scheduling Tasks from Callbacks............................................................................................................................................38
4Customizing the Adobe Bridge Browser Window...................................................................40
Creating a Customized Tabbed Palette................................................................................................................................40
Creating and displaying inspector panels ....................................................................................................................42
Specifying string values in an inspector panel............................................................................................................42
Panelette markup elements for dynamic text.......................................................................................................43
Registering your node-handling extension .................................................................................................................46
Installing a node-handling extension.............................................................................................................................46
Accessing the node-handling model and data...........................................................................................................48
Defining an ExtensionHandler.................................................................................................................................................49
Defining an ExtensionModel....................................................................................................................................................50
Immediate model operations............................................................................................................................................51
Long-running model operations......................................................................................................................................53
Defining Node Data Sets ..........................................................................................................................................................54
Managing the data cache ...................................................................................................................................................54
Core node data .......................................................................................................................................................................55
Implementing an operation...............................................................................................................................................56
Monitoring operation progress and status...................................................................................................................58
New Features in Adobe Bridge CS3.......................................................................................................................................66
Changes and Deprecations in Adobe Bridge CS3 ............................................................................................................67
Object model additions.......................................................................................................................................................67
Index ...........................................................................................................................................68
Welcome
Welcome to the Bridge JavaScript Guide. This book describes how to use JavaScript to manipulate and
extend Adobe® Bridge, a powerful file-browser available with many Adobe applications, which you can
invoke from the Go to Bridge icon.
Adobe Bridge provides a highly customizable platform that can be extended using a rich JavaScript API,
Flash® components, and HTML-based solutions. It includes the ExtendScript Toolkit, an interactive
development environment for JavaScript.
About This Book
This document describes how to use the scripting API to extend and manipulate Adobe Bridge. Complete
reference information for the JavaScript objects, properties, and functions defined by Adobe Bridge is
provided in a companion document, the Bridge JavaScript Reference.
● Adobe provides the ExtendScript Toolkit an interactive development environment (IDE) for JavaScript,
with all JavaScript-enabled Adobe applications. The ExtendScript Toolkit is documented in the
JavaScript Tools Guide. This book also provides documentation for various utilities and tools that are
part of ExtendScript, the Adobe extended implementation of JavaScript.
● The Bridge SDK, which contains this document, also contains a set of code samples (“Snippets”), that
demonstrate how to use the features of the Bridge JavaScript API. This book refers to these samples by
name for illustration of concepts and techniques. You can download the SDK from Adobe Developer
Center, http://www.adobe.com/devnet/
Who should read this book
This book is for developers who want to extend the capabilities of Adobe Bridge using JavaScript, call
Bridge functionality from scripts, and use scripts to communicate between Bridge-enabled applications. It
assumes a general familiarity with the following:
● JavaScript
● Adobe Bridge
● Any other Bridge-enabled applications you are using, such as Adobe Illustrator®, Adobe Photoshop®, or
Adobe InDesign®. The scripting API details for each application are included with the scripting
documentation for that product.
Note: If you have already been using the scripting interface to Bridge CS 2, see Chapter 6, “Porting Guide
for information about changes in this release.
.
”
6
Welcome About This Book 7
What is in this book
This book contains the following chapters:
● Chapter 1, “Scripting Adobe Bridge,” introduces some important concepts in Adobe Bridge scripting
and describes the Bridge JavaScript document object model (DOM).
● Chapter 2, “Interacting with Adobe Bridge through Scripts,” discusses the various ways of accessing
Thumbnail objects, describes how Bridge generates user-interaction events, and shows how you can
respond to these events by defining event handlers in your scripts.
● Chapter 3, “Creating a User Interface for a Script,” discusses the various options available to scripts for
interaction with Bridge users, such as dialog boxes and navigation bars, and describes how to use
these means to display a user interface defined in ScriptUI or in HTML.
● Chapter 4, “Customizing the Adobe Bridge Browser Window” describes how to add a script-defined
palette to Bridge, how to build a customized object-inspector pane that displays information related to
the selected node in any way you choose, and how to customize Bridge menus.
● Chapter 5, “Extending Adobe Bridge Node-Handling Behavior,” is intended for tool developers. It
describes how to extend the node-handling behavior of Bridge and define your own node types.
● Chapter 6, “Porting Guide,” summarizes changes and additions to this release, to help you in porting
existing scripting applications.
Document conventions
Typographical conventions
Monospaced font
ItalicsVariables or placeholders in code. For example, in
Blue underlined text
Sans-serif bold fontThe names of Bridge UI elements (menus, menu items, and buttons).
Note: Notes highlight important points that deserve extra attention.
Literal values; code, such as JavaScript or HTML code; file and path names.
myName represents a value you are expected to supply, such as name="Fred".
Also indicates the first occurrence of a new term.
An active link to a related section in this book or to a URL in your web browser.
> symbol is used as shorthand notation for navigating to menu items. For
The
example,
Edit > Cut refers to the Cut item in the Edit menu.
Where to go for more information
● For complete reference information for the JavaScript objects, properties, and functions defined by
Adobe Bridge, see the Bridge JavaScript Reference.
● Adobe provides an extended version of JavaScript, used in many Adobe products, called ExtendScript.
ExtendScript is a complete implementation of ECMA JavaScript, plus additional tool and utilities.
name="myName", the text
The JavaScript API includes rich functionality such as building blocks for user interface elements and
network connectivity. In addition, it allows you to to develop C and C++ native extensions.
For a description of the objects, tools, and utilities defined by Adobe ExtendScript, including the
ExtendScript Toolkit, see:
JavaScript Tools Guide
Welcome About This Book 8
● For a general introduction to scripting as a tool for working with Adobe applications, see:
Adobe Creative Suite: Introduction to Scripting
This book does not describe the JavaScript language. For documentation of the JavaScript language or
descriptions of how to use it, see any of numerous works on this subject, including the following:
● The public JavaScript standards organization web site: www.ecma-international.org
● JavaScript: The Definitive Guide, 4th Edition; Flanagan, D.; O’Reilly 2001; ISBN 0-596-00048-0
● JavaScript Programmer’s Reference; Wootton, C.; Wrox 2001; ISBN 1-861004-59-1
● JavaScript Bible. 5th Edition; Goodman, D. and Morrison, M.; John Wiley and Sons1998; ISBN
0-7645-57432
1
Scripting Adobe Bridge
This chapter introduces some important concepts in Adobe Bridge scripting and describes the Adobe
Bridge JavaScript API object model. For detailed descriptions of the objects and their properties and
methods, see the Bridge JavaScript Reference.
Note: If you have already been using the scripting interface to Adobe Bridge CS 2, see Chapter 6, “Porting
Guide” for information about changes in this release.
Scripting Overview
Adobe Bridge provides a configurable, extensible browser platform that allows users to search for, select,
and organize files by navigating among files and folders in the local file system, those on remote file
systems, and also web pages accessible over the Internet.
Adobe Bridge is integrated with Adobe applications, which bring up the Adobe Bridge browser window in
response to specific user actions that require file selection, or through a Browse button or command. You
can also bring up a browser window independently, by invoking it interactively or through a script.
The browser is highly configurable and extensible, using JavaScript. Adobe Bridge supports ExtendScript,
the Adobe extended implementation of JavaScript. ExtendScript files are distinguished by the
extension. ExtendScript offers all standard JavaScript features, plus additional features and utilities, such
as:
.jsx
● Platform-independent file and folder representation
● Tools for building a user interface to a script
● An interactive development and debugging environment, the ExtendScript Toolkit
For details of these features, see the JavaScript Tools Guide.
You can use JavaScript to manipulate browser windows and their contents programmatically, and to
change and extend their functionality. This manual describes what you can do, and provides an overview
of the JavaScript objects and functions that you can use to program Adobe Bridge.
Documentation and sample code
The Adobe Bridge Software Developer’s Kit (SDK), available from Adobe Developer Center,
http://www.adobe.com/devnet/
You can download and install the SDK in a folder with a name and location of your choice, referred to here
sdkInstall. The SDK contains:
as
sdkInstall/docs/
sdkInstall/javascript/docs/
sdkInstall/javascript/sdksamples/
, contains many code samples for Adobe Bridge and the JavaScript tools.
This document, and the companion documents Adobe Bridge JavaScript Reference and JavaScript Tools Guide.
Documentation for all of the JavaScript sample code in HTML
format.
A set of JavaScript code samples that illustrate Adobe Bridge
scripting concepts and techniques.
9
1: Scripting Adobe Bridge The Adobe Bridge Browser Window and Object Model 10
The sections in this manual that discuss particular concepts list the code samples that demonstrate the
related techniques.
Executing scripts for Adobe Bridge
Adobe Bridge executes JavaScript scripts in any of these ways:
● You can load and run a script in the ExtendScript Toolkit, specifying Adobe Bridge as the target
application. This is how to run the example code Snippets. The Toolkit is a development environment
for JavaScript, in which you can see debugging output and step through execution.
If you run a script for the ExtendScript Toolkit that has Adobe Bridge as its target, the Toolkit
automatically launches Adobe Bridge if it is not already running. Similarly, if another application sends
a JavaScript message to Adobe Bridge, the messaging framework launches Adobe Bridge if necessary.
For details of the Toolkit and messaging framework, see the JavaScript Tools Guide.
● You can create a menu command that runs a script and add it to a menu or submenu in the Adobe
Bridge browser, using the
● When the browser window displays a JSX file, you can double-click that file thumbnail to run the script
in its target application. It runs in Adobe Bridge if the script specifies Adobe Bridge as its target
application by including the directive:
#target bridge-2.0
MenuElement object. See ‘Extending Adobe Bridge Menus’ on page 44.
If the script specifies another application as its target, ExtendScript prompts the user to start that
application if necessary. If the script does not specify a target application, it opens in the ExtendScript
Toolkit. For details of application specifier syntax, see the JavaScript Tools Guide.
● You can pass a script to the Adobe Bridge executable, to be executed on startup, by dragging the JSX
file icon onto the Adobe Bridge executable file icon or shortcut. This script is executed after all startup
scripts found in the startup folders.
● Adobe Bridge has a dedicated location for user-installed startup scripts. This is the location referred to
by the Reveal button in the Preference/General panel. All JSX files found in these locations are
automatically run when Adobe Bridge is launched.
Other locations are used for the Adobe startup scripts that are supplied on installation of Adobe
Bridge-enabled applications. As a third-party developer, you must be very careful when installing
anything in these locations. They should be used only for extensions to the Adobe Bridge node-handling
model that support companion applications. For details, see Chapter 5, “Extending Adobe Bridge
Node-Handling Behavior.
The Adobe Bridge Browser Window and Object Model
An object model is an application programming interface (API), which allows you to programmatically
access various components of a document (as defined for that application) through a scripting language
such as JavaScript. In the case of Adobe Bridge, a "document" is defined as the browser window. This
section shows how each aspect of the API relates to the parts of the browser. A more detailed description
of the objects of the Adobe Bridge model follows in ‘The Adobe Bridge Object Model’ on page 14
.
1: Scripting Adobe Bridge The Adobe Bridge Browser Window and Object Model 11
The Adobe Bridge browser window
The browser window is highly configurable. A browser configuration is called a workspace. There are
predefined workspaces, and you can save and set the workspace interactively through the Window > Workspace menu, or through a script. User-defined workspaces are saved as XML files with the
The following figure identifies parts of the browser window in a default configuration and viewing mode.
menu bar
upper
navigation bar
FOLDER and
FAVORITES
palettes
FAVORITES:
Standard section
FAVORITES:
User section
FILTER palette
thumbnails
CONTENT pane
thumbnails
browser mode
P
REVIEW
palette
flyout
menu
METADATA
and
EYWORDS
K
palettes
status line
tabbed palettes
workspaces
The tabbed palettes are arranged in three columns . You can change the arrangement interactively.
Columns can be resized, and palette groups can also be resized within the column. Individual tabbed
palettes can be opened and closed, and dragged into different relative positions. Dragging a palette to the
bottom of an existing set adds a new tab set at the bottom of that column.
Your scripts can add customized palettes and menus, and control various aspects of the window
configuration and display.
1: Scripting Adobe Bridge The Adobe Bridge Browser Window and Object Model 12
Accessing the Adobe Bridge browser through scripts
The following table describes how the Adobe Bridge JavaScript API maps to the various parts and features
of the browser window, and how a script can access each part or feature through the Adobe Bridge object
model.
Window area Purpose Scripting control
Browser windowDisplays files, folders, and web
pages, along with related file
information and tools.
Thumbnails The labeled icons that appear
in the Folders/Favorites panes
as navigation nodes, and in
the Content pane and Preview
palette to represent files and
folders.
Favorites palette Provides a place for users to
drag and drop favorite items
(in the bottom half of the
pane).
Represented by the
Document object. Current
browser window (the one with the operating
system focus) is in
browser windows are in
app.document. All open
app.documents.
A script can create a new browser window by
creating a new
Document object.
The browser mode (full or compact) is
controlled by
app.document.browserMode.
The overall configuration of palettes is
controlled by
app.document.workspace. All
defined configurations are in
app.workspaces.
Thumbnail object represents a node in
The
the browser navigation hierarchy.
Thumbnails can represent
File or Folder
objects, URLs, or script-defined nodes
associated with script-defined
node-handling extensions. Adobe Version
Cue® nodes are an example of script-defined
nodes with their own behavior.
Access the visible thumbnails through the
app.favorites property, and traverse the
hierarchy through the
Thumbnail.children
properties.
Displays only top-level
containers and one level of
subnodes.
Folder palette Displays the file-system
navigation hierarchy.
Displays only containers (such
as folders and subfolders). The
content of the selected
container appears in the
Content pane.
Favorites object allows you to add
The
thumbnails to this pane.
User interaction with a thumbnail in this
pane generates an
target object and a location of
event with a Thumbnail
favorites.
Access the currently selected thumbnail in
the Folders pane through the
Document.thumbnail property. Traverse the
hierarchy through the
Thumbnail.children properties.
Thumbnail.parent and
User interaction with a thumbnail in this
pane generates an
target object and a location of
event with a Thumbnail
document.
1: Scripting Adobe Bridge The Adobe Bridge Browser Window and Object Model 13
Content pane Displays container contents
when you select a container
node in the Folders or
Favorites palette, or when you
double-click a navigable node
(such as a folder) in the
Content pane itself.
Displays both containers (such
as subfolders) and leaf nodes
(such as files and images).
Can also display web pages.
Controlled by the
Document.presentationMode, which you set
Document.setPresentationMode() to
with
one of these values:
● browser: Displays file and folder nodes,
represented by
Thumbnail objects, found
at the path specified in
Document.presentationPath. When a
folder is selected in the Folders pane,
access the current contents of the
Content pane through
app.document.thumbnail.children[].
● html: Displays an HTML page (local or
remote) specified by a URL in
Document.presentationPath.
User interaction with a thumbnail in this
pane generates an
target object and a location of
event with a Thumbnail
document. The
selected thumbnails are available through
Document.selections.
Preview palette Displays image previews.User interaction with a thumbnail in this
pane generates an
target object and a location of
event with a Thumbnail
preview.
Filter paletteAllows you to sort thumbnails
in the Content pane, or limit
the nodes shown to those
matching selected criteria.
FilterDescription object allows you to
The
specify filtering criteria for script-defined
node types.
When displaying a handled container node,
Adobe Bridge builds the list of filters by
calling the developer-defined
getFilterCriteria() method of the node's
ExtensionModel.
Metadata palette Displays embedded file
metadata information.
Embedded metadata is displayed and can be
modified for a specific thumbnail. Access
XMP metadata, encapsulated in a
object, from the
Thumbnail.metadata
Metadata
property.
app.synchronousMode before accessing
Set
metadata in a script, to ensure that Adobe
Bridge retrieves the latest valid data.
Keywords palette Displays keyword information. Not directly accessible to scripts, except
insofar as you can modify keywords defined
in embedded metadata.
1: Scripting Adobe Bridge The Adobe Bridge Object Model 14
Custom tabbed
palettes (not shown)
Script-defined tabbed palettes
that can be added to the
default palettes.
Inspector (not shown)An object-inspection palette
that displays further
information related to a
selected thumbnail in the
Content pane.
This type of palette is
script-defined; there is no
default version.
View mode controls Various controls at the bottom
right of the browser that set
the viewing mode to
predefined pane
configurations, and set the
display size of thumbnails in
the Content pane.
A new palette is represented by the
TabbedPalette object. A palette can display
HTML or ScriptUI user-interface elements;
ScriptUI can display Flash animation. The
TabbedPalette.title value is shown in the
tab.
Each palette is represented by the
InspectorPanel object, which contains one
or more subpanels. The subpanels display
information related to the focus thumbnail,
directly or indirectly through
Metadata properties. Various types of
Thumbnail or
subpanel are represented by subclasses of
Panelette base class.
the
The view mode is controlled by
app.document.thumbnailViewMode
. You can
control various aspects of the view with
Document properties such as
other
displayInspectorView, showFolders,
showThumbnailName, and so on.
Status line The bottom bar on the
browser window that displays
current status information.
Menubar The menubar at the top of the
browser window that contains
Adobe Bridge commands.
Context menus The right-click menus
associated with thumbnails,
and flyout menus for some
palettes, containing
context-specific commands.
Browser window upper
navigation bar
The navigation bar
immediately under the
menubar. Not configurable.
Top and bottom
navigation bars
Two configurable navigation
bars that can appear above
and below the Content pane.
Set text to be shown in the status line with
Document.status.
While this is not an object under direct
Document control, you can add menus and
commands using the
MenuElement object, by
referring to existing menus and commands.
You can add submenus and commands to
these menus using the
MenuElement object,
by referring to existing commands.
Not accessible to scripts.
Represented by predefined
accessed through the
NavBar objects,
Document.navbars
property. By default, the navigation bars are
invisible. You can make a bar visible, and add
ScriptUI or HTML UI elements to it.
The Adobe Bridge Object Model
Each application has its own object model, which consists of a hierarchical representation of the
application, and of the documents used in the application. The object model allows you to
1: Scripting Adobe Bridge The Adobe Bridge Object Model 15
programmatically access and manipulate the document and its components. Since the use of a document
varies for each application, the object model terminology varies for each application. For example, each
application's object model includes a
application, and the
Document class has different properties and methods for each application.
Document class, but the object referred to is different for each
Applications typically define a
images, or PDF documents. However, Adobe Bridge uses a different approach. In the object model, the
Document class refers to a browser window, and the properties and methods of Document refer to
various components of the user interface (UI). The browser window displays icons that reference the files
that other applications consider documents—HTML pages, images, PDFs, and so on. In the object model,
these icons are represented by the
Basic node model
App
Document
Favorites
Thumbnail
Document class to deal with files of a particular type, such as HTML pages,
Thumbnail class.
File, Folder
Metadata
Thumbnail
The application and documents
The Adobe Bridge App object is the root of the hierarchy, and represents the Adobe Bridge application. A
single global instance of the
App class, named app, is created when the application is started, and
provides access to global values. Even though the user can create multiple browser windows by selecting
the File > New Window command, making it appear that separate Adobe Bridge applications are running
in parallel, only a single instance of the application is running, which is reflected by a single instance of the
app object.
Document object represents a browser window. Each time a user selects File > New Window, a new
The
document object is created. When multiple browser windows are open, the user can select which window
to use by clicking the window to make it active. In a script, you can access the active, or most recently
used, browser window through the
available through the
app.documents array.
app.document property. The set of all open browser windows is
Thumbnails in documents
The Thumbnail object type represents a node, or browsable element in the browser navigation hierarchy.
It typically represents a a file or folder, but can also be associated with a web page. A document contains
various collections of
● Thumbnail objects can contain other Thumbnail objects, as for example, when a folder contains
files. In this case, the
contains a hierarchy of
Thumbnail objects.
container property of the Thumbnail is true, and the children property
Thumbnail objects that represent files and folders contained in the folder.
1: Scripting Adobe Bridge The Adobe Bridge Object Model 16
● The Folders pane shows the full navigation hierarchy of folders and subfolders for the local file system,
and for virtual file systems such as that defined by Version Cue. Scripts can add nodes to the Folders
pane using
app.document.thumbnail property, and can walk the navigation hierarchy by accessing the
the
parent and children properties of each Thumbnail object.
● The Favorites pane shows a selection of high-level nodes, some predefined (in the upper Standard
app.addCustomRoot(). A script can access the currently selected thumbnail through
section) and some chosen by the user (in the lower User section). These nodes can represent web
pages, virtual locations such as Stock Photos, and remote folders, as well as local folders. The
Favorites object represents the navigation nodes in the Favorites pane. A document contains a
Favorites object, which contains two arrays of Thumbnail objects, for the Standard and User
single
sections. Access the
● A script can add thumbnails to the User section of the Favorites pane by using the Favorites
object’s
insert method, and one level of sub-nodes using the addChild method. A subnode can
be any thumbnail; it does not have to be part of the root node’s
● A script cannot remove thumbnails in the Standard section, but they can be shown or hidden with a
Preference, and a script can modify the Preference and display state using
Favorites.disable().
and
● You can add customized panes or palettes to the browser window which can display thumbnails, or
Favorites object through app.favorites.
children hierarchy.
Favorites.enable()
information directly or indirectly contained in selected thumbnails; see ‘Customizing the user interface’
on page 17.
For additional information about how to work with
Scripts’ on page 23.
Scripting Adobe Bridge interactions
App
Application preferences
The Preferences object allows a script to access Adobe Bridge application preferences. These are the
values that can be viewed interactively in the Preferences dialog, in response to the Edit > Preferences
command. The settings are stored and persist across sessions. Your script can use the
object to view or set existing preferences, or to add new preference fields. In some cases, when you modify
persistent preference values, the new settings are not reflected in the browser window until the
application is restarted.
When the user brings up a Preferences dialog, Adobe Bridge invokes a ScriptUI dialog window, and
generates a
register an event handler for this event that uses the object’s
containing ScriptUI controls that show and allow the user to modify script-defined preference values.
create event with the PreferencesDialog object as its target. You can define and
Preferences
Event
Thumbnail objects, see ‘Accessing Thumbnails with
PreferencesDialog
Preferences
add method to add a ScriptUI panel
User-interaction events
When interacting with Adobe Bridge, a user takes actions such as changing the thumbnail selection, or
creating a new browser window. For most of these actions, Adobe Bridge triggers a user-interaction event,
1: Scripting Adobe Bridge The Adobe Bridge Object Model 17
represented by an Event object of a particular event type, with a particular target object, such as an App,
Document, or Thumbnail object. Some function calls can also trigger events.
Adobe Bridge defines default behavior for user-interaction events. You can extend or override the default
behavior by defining and registering an event-handler function. This function receives the
Event object as
an argument, and returns a value that tells Adobe Bridge whether to continue with the default behavior or
to ignore it.
For more information, see ‘Event Handling in Adobe Bridge’ on page 27
Customizing the user interface
You can add user interfaces to your scripts or browser interactions, and your scripts can customize the
browser window.
App
Document
MenuElement
InspectorPanel
TabbedPalette
NavBar
Dialog
Panelette
.
TextPanelette
IconListPanelette
ThumbnailPanelette
Customizing the browser window
● You can define additional tabbed palettes like those provided by default, using the TabbedPalette
object. These can display HTML or ScriptUI content. Script UI provides a complete set of user-interface
components that includes a Flash movie player.
● You can define object-inspection palettes using the InspectorPanel, which contains customized
subpanels that display information related to the currently selected thumbnail. The selected thumbnail
is the inspection focus of the display.
By default, these script-defined palettes appear in the upper left of the browser, but once they are
displayed, you can resize them and drag them to new locations, like the predefined palettes.
The following figures show a script-defined palette with ScriptUI content, and a script-defined Inspector
panel, both created by the example scripts in the Adobe Bridge SDK.
1: Scripting Adobe Bridge The Adobe Bridge Object Model 18
The displayed information in an Inspector can be related to the selected node through embedded file
metadata (in associated
Thumbnail object (see Chapter 5, “Extending Adobe Bridge Node-Handling Behavior").
Metadata objects) or through Adobe Bridge- or script-defined properties of the
For information on how to make these additions, see Chapter 4, “Customizing the Adobe Bridge Browser
Window.
1: Scripting Adobe Bridge The Adobe Bridge Object Model 19
Communicating with the user from a script
Your script can display information to or collect information from the user by configuring the supplied
Navigation bars
ExtendScript provides a set of user-interface objects in the ScriptUI module, which defines windows and
user-interface controls. You can use these objects to define a user interface for your application, in the
form of popup dialogs, persistent dialogs (called palettes), or as part of navigation bars. The usage of the
ScriptUI objects is discussed in the JavaScript Tools Guide.
You can also define a user interface using standard HTML. When integrating your user interface with the
browser, you can use either ScriptUI or HTML controls for any window or pane, but cannot mix the two. For
a complete discussion, see Chapter 3, “Creating a User Interface for a Script
In addition to displaying a user interface for your script, you can script user interactions by extending the
Adobe Bridge Menus
Navigation bars
The Adobe Bridge navigation bar immediately below the menubar cannot be scripted, but there are two
configurable navigation bars, above and below the Content pane. They are represented by
objects, which you can access through the
, or by creating and displaying Dialogs.
."
.
NavBar
Document object’s navbars property.
The following figure shows a navigation bar defined by Adobe StockPhotos.
By default, the navigation bars are hidden and empty.
● You can show and hide a navigation bar by setting the object’s visible property.
● You can configure a navigation bar to display either ScriptUI user-interface controls, or straight HTML
controls. It cannot mix the two.
● To display ScriptUI controls, set the type property to "scriptui", then use the NavBar.add
method to add controls.
● To display HTML controls, set the type property to "html", and the file property to the HTML file
that defines the page you want to display.
You can program the controls to display information to or collect information from the user. For additional
details, see ‘Navigation bars’ on page 31
.
Dialogs
Your script can define dialogs to display information to or get information from the user. There are two
ways to define these:
● ScriptUI Dialogs: Use the ScriptUI Window object to define a dialog that displays ScriptUI controls. For
details of programming ScriptUI dialogs, see the JavaScript Tools Guide.
1: Scripting Adobe Bridge The Adobe Bridge Object Model 20
● HTML Dialogs: The Adobe Bridge Dialog object represents a window that displays an HTML page,
rather than ScriptUI controls. For details of programming Adobe Bridge dialogs, see ‘Displaying HTML
in Adobe Bridge dialogs’ on page 36.
You can invoke ScriptUI or Adobe Bridge dialogs from a script as modal or nonmodal dialogs.
● A modal dialog retains the input focus, and does not allow the user to interact with any other
application windows until the dialog is dismissed. The function that invokes it does not return until the
dialog is dismissed.
● A nonmodal dialog (known in ScriptUI as a palette), does not keep the input focus. The user can interact
with other application windows while the dialog is up. The function that invokes it returns
immediately, leaving the dialog on screen until the user or script closes it.
Menus
The MenuElement object allows you to extend Adobe Bridge menus. A script cannot remove or alter the
behavior of predefined menu items, but you can add, remove, and modify script-defined menus,
submenus and commands.
The menu bar, and most menus, submenus, and context menus can be extended by creating new
MenuElement objects that reference existing menus and menu items. The identifiers of all menus and
menu items that are accessible to scripts are listed with the description of the
‘Extending Adobe Bridge Menus’ on page 44
.
MenuElement object in
1: Scripting Adobe Bridge The Adobe Bridge Object Model 21
Extending browser behavior
Adobe Bridge provides a development infrastructure for advanced developers who want to create plug-in
type extensions to basic Adobe Bridge functionality, in order to integrate Adobe Bridge with other
applications and systems.
App
ExtensionHandler
SearchSpecification
ExtensionModel
SearchDefinition
SearchCondition
Infoset
SortCriterion
FilterDescription
Operator
SearchCriteria
InfosetMemberDescription
ModalOperator
ProgressOperator
An advanced developer can extend the default node-handling behavior by defining a new node type, and
a node-handling extension that manages that node type. When you define a node type, you assign an
identifying prefix (or more than one), and register that prefix to associate it with the
ExtensionHandler
object that implements the handler.
To implement a node-handling extension, you define
ExtensionHandler and ExtensionModel
classes, providing the node-handling methods.
● You can create script-defined properties in the Thumbnail object for your handled nodes, using the
Infoset object. You can access and display this kind of node data in a custom Inspector panel; see
‘Script-Defined Inspector Panels’ on page 41
● You can define node search and filter criteria that consider the values of metadata and node data
.
properties associated with your node types.
● You can define sorting criteria that determine how your nodes are ordered in the Content pane or
Inspector panels.
● For time- or resource-intensive tasks such as those involving file-system access, your model methods
must define an
For a complete discussion, see Chapter 5, “Extending Adobe Bridge Node-Handling Behavior
Operator object to execute and monitor the operation.
."
1: Scripting Adobe Bridge The Adobe Bridge Object Model 22
The following figure show the result of running the basic node-handling extension example provided with
the Adobe Bridge SDK. Additional examples show how to add node-specific information to your own node
types, and how to search and filter nodes of the handled type, based on the node-specific information.
Node of handled type added to
Favorites palette
Container and leaf nodes of handled type displayed in
Content pane
Loading...
+ 49 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.