Script Versioning; Targeting; Compilation; Interpretation - Adobe 65009333 - InCopy CS4 - PC Manual

Scripting guide: javascript
Hide thumbs Also See for 65009333 - InCopy CS4 - PC:
Table of Contents

Advertisement

Scripting Features

Script versioning

InCopy CS4 can run scripts using earlier versions of the InCopy scripting object model. To run an older
script in a newer version of InCopy, you must consider the following:
Targeting — Scripts must be targeted to the version application in which they are being run (i.e., the
current version). The mechanics of targeting are language specific.
Compilation — This involves mapping the names in the script to the underlying script ids, which are
what the application understands. The mechanics of compilation are language specific.
Interpretation — This involves matching the ids to the appropriate request handler within the
application. InCopy CS4 correctly interprets a script written for an earlier version of the scripting object
model. To do this, run the script from a folder in the Scripts panel folder named
(for InCopy CS2 scripts) or
application's script preferences to the old object model within the script (as shown below).

Targeting

Targeting for JavaScripts is implicit when the script is launched from the Scripts panel. If the script is
launched externally (from the ESTK), use the
//target CS4
#target "InCopy-5.0"
//target the latest version of InCopy
#target "InCopy"

Compilation

JavaScripts are not pre-compiled. For compilation, the application uses the same version of the DOM that
is set for interpretation.

Interpretation

The InCopy application object contains a
version of the scripting object model to use for interpreting scripts. The version defaults to the current
version of the application and persists.
//Set to 4.0 scripting object model
app.scriptPreferences.version = 4.0;

Using the doScript method

The
doScript
scripting code or a file on disk. The script can be in the same scripting language as the current script or
another scripting language. The available languages vary by platform: on Mac OS, you can run either an
AppleScript or a JavaScript; on Windows, you can run a VBScript or a JavaScript.
Version 3.0 Scripts
method gives a script a way to execute another script. The script can be a string of valid
(for InCopy CS scripts) or explicitly set the
directive:
target
object, which allows a script to get/set the
scriptPreferences
Script versioning 21
Version 4.0 Scripts

Advertisement

Table of Contents
loading

This manual is also suitable for:

Incopy cs4

Table of Contents