
CHAPTER 5: Interapplication Communication with Scripts Cross-DOM functions 168
of application-specific functions. Each application determines the extent of its exported functionality.
Some applications provide extensive support for exported functions, others less.
For details of additional functions that are exported by individual applications, refer to the startup scripts
for those applications. The application startup scripts are named
appname-n.jsx, where n is the version
number of the installed application. See “
Startup folder locations” on page 168.
Startup folder locations
For each platform, there is a startup folder shared by all Adobe Creative Suite 4 applications that support
JavaScript, and an application-specific startup folder.
X In Windows
®
, the installation startup folders are:
%CommonProgramFiles%\Adobe\Startup Scripts CS5\Adobe AppName\
X
In Mac OS
®
, the installation startup folders are:
/Library/Application Support/Adobe/Startup Scripts CS5/Adobe AppName/
NOTE: This is not the location in which to store your own startup scripts; see “Scripting for specific
applications” on page 12.
Cross-DOM API reference
All exported functions, including those of the cross-DOM API, are invoked through the exporting
application, identified by its namespace specifier (see “
Namespace specifiers” on page 193). For example:
//execute an Illustrator script in version 12
illustrator12.executeScript(myAIScript);
A specifier with no version information invokes the highest installed version of the application. For
example:
//execute a Photoshop script in the highest available version
photoshop.executeScript (myPSScript)
All message-enabled applications implement the following cross-DOM functions:
executeScript()
appspec.executeScript(script)
script
A string containing the script to be evaluated.
Performs a JavaScript
eval on the specified script. The entire document object model (DOM) of the
target application is available to the script. Returns
undefined.
open()
appspec.open(files)
files
A File object or array of File objects. For applications that use compound documents,
this should be a project file.
Performs the equivalent of the target application’s File > Open command on the specified files.
Returns
undefined.
Komentarze do niniejszej Instrukcji