EDOBE XDOM TAKE 6 IR - PRODUCTSHEET Especificações Página 170

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 304
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 169
CHAPTER 5: Interapplication Communication with Scripts Communicating through messages 170
Communicating through messages
Adobe Bridge provides an application programming interface (API) that defines a communication
protocol between Adobe ExtendScript- and message-enabled applications. This provides the most
general mechanism for communication between applications. A messaging-enabled application can
launch another messaging-enabled application, and send or receive scripts to effect certain actions. For
example, from within Adobe Bridge, a script can launch Photoshop, and then send a script to Photoshop
that requests a photomerge operation.
While the exported functions allow specific access to certain capabilities of the application, the script in an
interapplication message allows full access to the target application’s document object model (DOM), in
addition to all cross-DOM and application exported functions.
The messaging API defines the BridgeTalk class
, whose globally available static properties and functions
provide access to environmental information relevant for communication between applications. You can
instantiate this class to create a BridgeTalk message object
, which encapsulates a message and allows you
to send it to another application. For details of these objects, see
Messaging framework API reference” on
page 179.
Sending messages
To send a script or other data to another application, you must create and configure a BridgeTalk message
object. This object contains the data to be sent (generally a script to be executed in the target application),
and also specifies how to handle the response.
This simple example walks through the steps of sending a script from Adobe Bridge CS5 to Photoshop
CS5, and receiving a response.
Step 1: Check that the target application is installed
Before you can actually send a message, you must check that the required version of the target application
is installed. The function getSpecifier()
, available in the global namespace through the BridgeTalk
class, provides this information.
For example, this code, which will send a message to Adobe Bridge CS5 as part of a script being executed
by Photoshop CS5, checks that the required version of Adobe Bridge is installed:
var targetApp = BridgeTalk.getSpecifier( "bridge-3.0");
if( targetApp ) {
// construct and send message
}
When you send the message, the messaging framework automatically launches the target application, if it
is not already running.
Step 2: Construct a message object
The next step is to construct a message to send to the application. You do this by creating a BridgeTalk
message object, and assigning values to its properties. You must specify the target application and the
message body, which is usually a script packaged into a string.
Scripts sent in messages can be very complex, and can use the full DOM of the target application. This
example defines a message script that accesses the Adobe Bridge DOM to request the number of files or
folders found in a specific folder:
// create a new BridgeTalk message object
Vista de página 169
1 2 ... 165 166 167 168 169 170 171 172 173 174 175 ... 303 304

Comentários a estes Manuais

Sem comentários