-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path$$.estk.jsxinc
115 lines (88 loc) · 3.86 KB
/
$$.estk.jsxinc
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
/*******************************************************************************
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: 240626 (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, keep in mind that IdExtenso is primarily thought to automate
InDesign, hence DOM-oriented modules and functions (`$$.Env`, `$$.Dom`...)
will either stop working or return irrelevant data.
*/
//==========================================================================
// 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]
// ---
$.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 = 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;