bridgetalk-class
BridgeTalk class
Section titled “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;
Attributes
Section titled “Attributes”The BridgeTalk class provides these static properties, which are available in the global namespace:
BridgeTalk.appInstance
Section titled “BridgeTalk.appInstance”BridgeTalk.appInstance
Description
Section titled “Description”The instance identifier of an application launched by the messaging framework, the instance portion of an application specifier; see Application specifiers.
Used only for those applications, such as InDesign, that support launching and running multiple instances.
String. Read only.
BridgeTalk.appLocale
Section titled “BridgeTalk.appLocale”BridgeTalk.appLocale
Description
Section titled “Description”The locale of this application, the locale portion of an application specifier; see Application specifiers. When a message is sent, this is the locale of the sending application.
String. Read only.
BridgeTalk.appName
Section titled “BridgeTalk.appName”BridgeTalk.appName
Description
Section titled “Description”The name of this application, the appname portion of an application specifier; see Application specifiers. When a message is sent, this is the name of the sending application.
String. Read only.
BridgeTalk.appSpecifier
Section titled “BridgeTalk.appSpecifier”BridgeTalk.appSpecifier
Description
Section titled “Description”A lower-case string containing the complete specifier for this application; see Application specifiers.
String.
BridgeTalk.appStatus
Section titled “BridgeTalk.appStatus”BridgeTalk.appStatus
Description
Section titled “Description”The current processing status of this application. One of:
busy
: The application is currently busy, but not processing messages. This is the case, for example, when a modal dialog is shown.idle
: The application is currently idle, but processes messages regularly.not installed
: The application is not installed.
String. Read only.
BridgeTalk.appVersion
Section titled “BridgeTalk.appVersion”BridgeTalk.appVersion
Description
Section titled “Description”The version number of this application, the version portion of an application specifier; see Application specifiers. When a message is sent, this is the version of the sending application.
String. Read only.
BridgeTalk.onReceive
Section titled “BridgeTalk.onReceive”BridgeTalk.onReceive
Description
Section titled “Description”Returns
Section titled “Returns”callback function that this application applies to unsolicited incoming messages. The default function evaluates the body of the received message and returns the result of evaluation. To change the default behavior, set this to a function definition in the following form:
BridgeTalk.onReceive = function( bridgeTalkObject ) { // act on received message};
The body property of the received message object contains the received data. The function can return any type. See Handling unsolicited messages.
Function
Methods
Section titled “Methods”The BridgeTalk class provides these static methods, which are available in the global namespace:
BridgeTalk.bringToFront()
Section titled “BridgeTalk.bringToFront()”BridgeTalk.bringToFrontapp)
Description
Section titled “Description”Brings all windows of the specified application to the front of the screen.
In Mac OS, an application can be running but have no windows open. In this case, calling this function might or might not open a new window, depending on the application. For Adobe Bridge, it opens a new browser window.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
app | Application specifiers | A specifier for the target application |
Returns
Section titled “Returns”Nothing
BridgeTalk.getAppPath()
Section titled “BridgeTalk.getAppPath()”BridgeTalk.getAppPathapp)
Description
Section titled “Description”Retrieves the full path of the executable file for a specified application.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
app | Application specifiers | A specifier for the target application |
Returns
Section titled “Returns”String
BridgeTalk.getDisplayName()
Section titled “BridgeTalk.getDisplayName()”BridgeTalk.getDisplayNameapp)
Description
Section titled “Description”Returns a localized display name for an application, or null
if the application is not installed. For example:
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
app | Application specifiers | A specifier for the target application |
Returns
Section titled “Returns”String
Example
Section titled “Example”BridgeTalk.getDisplayName("photoshop-10.0");=> Adobe Photoshop CS4
BridgeTalk.getSpecifier()
Section titled “BridgeTalk.getSpecifier()”BridgeTalk.getSpecifierappName[, version][, locale])
Description
Section titled “Description”Retrieves a complete application specifier.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
appName | The base name of the application to search for. | |
version | Number | Optional. The specific version number to search for. |
If 0 or not supplied, returns the most recent version. | ||
If negative, returns the highest version up to and including the absolute value. | ||
If a major version is specified, returns the highest minor-version variation. For example, if Photoshop CS versions 9, 9.1, and 10 are installed: | ||
BridgeTalk.Specifier( “photoshop”, “9” ) | ||
locale | String | Optional. The specific locale to search for. If not supplied and multiple language versions are installed, prefers the version for the current locale. |
Returns
Section titled “Returns”Application specifier for a messaging-enabled application version installed on this computer, or null
if the requested version of the application is not installed.
Example
Section titled “Example”For example, assuming installed applications include Photoshop CS4 11.0 en_us
, Photoshop CS2 8.5 de_de
, Photoshop CS2 9.0 de_de
, and Photoshop CS2 9.5 de_de
, and that the current locale is en_US
BridgeTalk.getSpecifier ("photoshop"); => ["photoshop-11.0-en_us"]
BridgeTalk.getSpecifier ("photoshop", 0, "en_us"); => ["photoshop-11.0-en_us"]
BridgeTalk.getSpecifier ("photoshop", 0, "de_de"); => ["photoshop-9.5-de_de"]
BridgeTalk.getSpecifier ("photoshop", -9.2, "de_de"); => ["photoshop-9.0-de_de"]
BridgeTalk.getSpecifier ("photoshop", 8); => ["photoshop-8.5-de_de"]
BridgeTalk.getStatus()
Section titled “BridgeTalk.getStatus()”BridgeTalk.getStatus(targetSpec)
Description
Section titled “Description”Retrieves the processing status of an application.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
targetSpec | Application specifiers | Optional. A specifier for the target application. If not supplied, returns the processing status of the current application. |
Returns
Section titled “Returns”String, one of:
BUSY
: The application is currently busy, but not processing messages. This is the case, for example, when a modal dialog is shown.IDLE
: The application is currently idle, but processes messages regularly.PUMPING
: The application is currently processing messages.ISNOTRUNNING
: The application is installed but not running.ISNOTINSTALLED
: The application is not installed.UNDEFINED
: The application is running but not responding to ping requests. This can be true of a CS2 application that uses an earlier version of the messaging framework.
BridgeTalk.getTargets()
Section titled “BridgeTalk.getTargets()”BridgeTalk.getTargets([version],[locale])
Description
Section titled “Description”Retrieves a list of messaging-enabled applications installed on this computer.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
version | Number | Optional. The specific version number to search for, or null to return the most appropriate version (matching, most recent, or running), with version information. |
Specify only a major version number to return the highest minor-version variation. | ||
For example, if Photoshop CS versions 9, 9.5, and 10 are installed | ||
BridgeTalk.getTargets( “9” ) | ||
Specify a negative value to return all versions up to the absolute value of the version number. For example | ||
BridgeTalk.getTargets( “-9.9” ) | ||
locale | String | Optional. The specific locale to search for, or null to return applications for all locales, with locale information. If not supplied when version is supplied, returns specifiers with version information only. |
Returns
Section titled “Returns”Returns an array of Application specifiers.
- If version is supplied, specifiers include the base name plus the version information.
- If locale is supplied, specifiers include the full name, with both version and locale information.
- If neither version nor locale is supplied, returns base specifiers with neither version nor locale information, but tries to find the most appropriate version and locale; see Application specifiers.
Example
Section titled “Example”For example, assuming installed applications include Photoshop CS3 10.0 en_US
, Photoshop CS4 11.0 en_us
, and Illustrator CS4 14.0 de_de
BridgeTalk.getTargets(); => [photoshop,illustrator]
BridgeTalk.getTargets( "10.0" ); => [photoshop-10.0]
BridgeTalk.getTargets( null ); => [photoshop-11.0, illustrator-14.0]
BridgeTalk.getTargets( null, "en_US" ); => [photoshop-10.0-en_US, photoshop-11.0-en_US]
BridgeTalk.getTargets( null, null ); => [photoshop-10.0-en_US, photoshop-11.0-en_us, illustrator-14.0-de_de]
BridgeTalk.isRunning()
Section titled “BridgeTalk.isRunning()”BridgeTalk.isRunning(specifier)
Description
Section titled “Description”Checks whether a given application is running and active on the local computer.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
specifier | Application specifiers | A specifier for the target application |
Returns
Section titled “Returns”Boolean
BridgeTalk.launch()
Section titled “BridgeTalk.launch()”BridgeTalk.launch(specifier[, where])
Description
Section titled “Description”Launches the given application on the local computer. It is not necessary to launch an application explicitly in order to send it a message; sending a message to an application that is not running automatically launches it.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
specifier | Application specifiers | A specifier for the target application |
where | Unknown. | Optional. If the value “background” is specified, the application’s main window is not brought to the front of the screen. |
Returns
Section titled “Returns”Boolean. true
if the application has already been launched, false
if it was launched by this call.
BridgeTalk.loadAppScript()
Section titled “BridgeTalk.loadAppScript()”BridgeTalk.loadAppScript(specifier)
Description
Section titled “Description”Loads the startup script for an application from the common StartupScripts folders. Use to implement late loading of startup scripts.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
specifier | Application specifiers | A specifier for the target application |
Returns
Section titled “Returns”Boolean. true
if the script was successfully loaded.
BridgeTalk.ping()
Section titled “BridgeTalk.ping()”BridgeTalk.ping(specifier, pingRequest)
Description
Section titled “Description”Sends a message to another application to determine whether it can be contacted.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
specifier | Application specifiers | A specifier for the target application |
pingRequest | Identifying key string, one of: | Specific type of return value. |
- STATUS : Returns the processing status; see getStatus(). | ||
- DIAGNOSTICS : Returns a diagnostic report that includes a list of valid ping keys. | ||
- ECHO_REQUEST : Returns ECHO_RESPONSE for a simple ping request. |
Returns
Section titled “Returns”String
BridgeTalk.pump()
Section titled “BridgeTalk.pump()”BridgeTalk.pump()
Description
Section titled “Description”Checks all active messaging interfaces for outgoing and incoming messages, and processes them if there are any.
Returns
Section titled “Returns”Boolean. true
if any messages have been processed, false
otherwise.