-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path$$.estk.jsxinc
More file actions
124 lines (97 loc) · 4.13 KB
/
$$.estk.jsxinc
File metadata and controls
124 lines (97 loc) · 4.13 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*******************************************************************************
Name: IdExtenso Entry Point for ESTK
Desc: Patch for running IdExtenso from ExtendScript ToolKit (without InDesign.)
Path: $$.estk.jsxinc
Require: ---
Encoding: ÛȚF8
Core: YES
Kind: Entry point.
API: ---
DOM-access: NO
Todo: ---
Created: 180614 (YYMMDD)
Modified: 260324 (YYMMDD)
*******************************************************************************/
//==========================================================================
// NOTICE
//==========================================================================
/*
The idea behind this alternate Entry Point is to allow ESTK to run IdExtenso
without InDesign. So, instead of the regular directive
#include 'path/to/$$.jsxinc'
you now have the option to use
#include 'path/to/$$.estk.jsxinc'
in order to execute a script which is based on IdExtenso but does not require
any InDesign feature.
THIS OPTION IS PURELY EXPERIMENTAL THOUGH. Some demo scripts will run fine
as they don't invoke InDesign at all. For example, $$.help() should be OK
in ExtendScript ToolKit (however Photoshop can't run it due to incompatibili-
ties with ScriptUI's listbox implementation.)
Thanks to this special patch you can enjoy CORE modules like `JSON` or `Log`
in your scripts, and even extra modules like `Yalt`, `MD5`, `BigInt`...
However, InDesign DOM-oriented modules and functions (`$$.Env`, `$$.Dom`...)
will either return irrelevant data or just stop working...
*/
//==========================================================================
// BEFORE INCLUDE
//==========================================================================
if( !$.global['NothingEnum'] )
//----------------------------------
// [180615] Dummy DOM objects required to allow IdExtenso to start up.
{
$.global.G = $.global;
G.Enumeration = function Enumeration(){ this['0']='0' };
G.Enumeration.prototype.toString = function toString(){ return '0' };
G.Enumeration.prototype.valueOf = function valueOf(){ return 0 };
// ---
G.NothingEnum = new G.Enumeration;
G.Locale = new G.Enumeration;
G.UndoModes = new G.Enumeration;
G.UserInteractionLevels = new G.Enumeration;
G.MeasurementUnits = new G.Enumeration;
G.PerformanceMetricOptions = new G.Enumeration; // [ADD210403]
// ---
// [REM260129] The dummy G.app={...} is just a fallback,
// ESTK already exposes a [[global]] `app` object with
// a few properties (name, version...)
// ---
$.global.A = G.app || (G.app={ version:"1.0", name:"estk" });
A.translateKeyString = function translateKeyString(s){ return String(s) };
A.findKeyStrings = function findKeyString(s){ return String(s) };
A.activate = function activate(){ };
A.scriptPreferences =
{
version: A.version,
enableRedraw: 0,
userInteractionLevel: 0,
scriptsFolder: Folder.myDocuments,
measurementUnit: 0,
};
A.generalPreferences = { properties:0 };
A.userName = '';
A.locale = 0;
A.fullName = A.name;
A.properties =
{
estkEntryPoint: 1, // [ADD260129] So `app.properties.estkEntryPoint` is reliable and won't hurt InDesign.
enableRedraw: 0,
userInteractionLevel: 0,
};
A.layoutWindows = 0; // [FIX190303]
delete $.global.A;
delete $.global.G;
}
//==========================================================================
// REGULAR ENTRY POINT
//==========================================================================
#include '$$.jsxinc'
//==========================================================================
// AFTER INCLUDE
//==========================================================================
// Hack ~.ISCL => Preserve dummy Live objects (Locale, UndoModes...)
// [181128] Shorter code!
// ---
;$$['~'].ISCL.GLO_DOMK.length = 0;
// [190204] Seems required in ESTK CS4.
// ---
;$$['~'].ISCL.KEEP_OBJ_PROTO = 1;