-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathEnvSummary.jsx
More file actions
66 lines (58 loc) · 1.63 KB
/
EnvSummary.jsx
File metadata and controls
66 lines (58 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// IdExtenso wants to run in INDD.
// ---
#target 'indesign'
// Path to IdExtenso entry point.
// ---
#include '../$$.jsxinc'
// Load the framework in TRACE log mode.
// ---
$$.load(-1);
// =============================================================================
// EnvSummary [170422]
// -----------------
// Study the scripting context using the Env module.
// Demonstrates:
// - Usage of `$$.Env.domVersion()` -- shortcut: `$$.domVersion()`
// - Usage of `$$.Env.summary()` -- shortcut: `$$.Env()`
// - Main script and Running code status (JSX vs. JSXBIN),
// see EnvSummary.bin.jsx for a complete description.
// - Log in TRACE mode.
// =============================================================================
try
{
// ---
// $$.domVersion(ver) tells whether the current
// DOM version is greater-or-equal than ver.
// ---
if( $$.domVersion(9) )
{
// Downgrade to Scripting DOM 8.0 (=CS6).
// ---
app.scriptPreferences.version = '8.0';
}
if( $$.domVersion(7) )
{
// ScriptPreference.measurementUnit requires CS5 or higher.
// ---
app.scriptPreferences.measurementUnit = MeasurementUnits.PICAS;
}
// Trace the current environment of the script.
// Note: $$.Env() is a shortcut of $$.Env.summary().
// ---
var separator = $$.newLine+$$.Log.spaces;
$$.trace(__(
"EnvSummary (after some changes) > %1",
separator + $$.Env(separator)
));
}
catch(e)
{
// Just in case something goes wrong.
// ---
$$.receiveError(e);
}
// =============================================================================
// Please, unload the framework to cleanup memory.
// (Good practice in engine-persistent scripts!)
// ---
$$.unload();