
CHAPTER 5: Interapplication Communication with Scripts Messaging framework API reference 179
Messaging framework API reference
This application programming interface (API) defines a communication protocol between
message-enabled applications. These objects are available to all ExtendScript scripts when any of the
applications is loaded.
The messaging protocol is extensible. Although it is primarily designed to send scripts, you can use it to
send other kinds of data.
The messaging API defines the
BridgeTalk class. Static properties and methods of the class provide
access to environmental information relevant for communication between applications. Instantiate the
class to create a
BridgeTalk message object, which encapsulates the message itself. For discussion and
examples, see “
Communicating through messages” on page 170, and the example code provided with the
Adobe ExtendScript SDK.
Example code
The sample code distributed with the Adobe ExtendScript SDK includes these code examples that
specifically demonstrate the use of interapplication messaging:
BridgeTalk class
Static properties and methods of this class provide a way for your script to determine basic messaging
system information before you create any specific message objects. Static methods allow you to check if
an application is installed and is already running, and to launch the application. A callback defined on the
class determines how the application processes incoming messages.
You can access static properties and methods in the
BridgeTalk class, which is available in the global
namespace. For example:
var thisApp = BridgeTalk.appName;
NOTE: You must instantiate the BridgeTalk class to create the BridgeTalk message object, which is used
to send message packets between applications. Dynamic properties and methods can be accessed only in
instances.
Interapplication messaging
MessagingBetweenApps.jsx
MessageSendingToInDesign.jsx
Shows how to send a message to a Creative Suite application
and receive a response.
SendArrayToPhotoshop.jsx
Sends message to Photoshop that creates an array in the
target and passes it back to the sender.
SendObjectToPhotoshop.jsx
Sends message to Photoshop that creates a JavaScript object
in the target and passes it back to the sender.
SendDOMObjectToPhotoshop.jsx
Sends message to Photoshop that creates a Photoshop object
in the target and passes values from it back to the sender.
SaveAsDifferentFileType.jsx
Locates an image file, uses messaging to load it into
Photoshop and save it as a different file type.
Comentarios a estos manuales