Sunteți pe pagina 1din 3

BobsESTKExtras

BobsESTKExtras are a set of utilities designed for people developing


applications for Adobes Creative Suite 3 in JavaScript. These utilities are
installed into Adobes ExtendScript Toolkit 2 (ESTK), and are fully integrated into
the ESTK.
This script contains 2 extras. The first opens a script file and converts it to ASCII.
If you are writing CSXS extensions for InDesign, you must convert the jsx file to
ASCII prior to building the extensions mxp file. The ESTK itself does not support
this; but, this extension will do it for you.
The second script does a batch conversion of jsx files to jsxbin files. The ESTK
limits you to one at a time.
Scripted projects I write typically contain many jsx files. Doing a one-by-one
Export to Binary using the ESTKs feature, for me, takes most of an hour for
one of my larger projects. That same project is exported to Binary using the
batch process in about 10 seconds, and it never forgets a file (which is why it
takes so darned long to do it manually!).
Enjoy!

Installation
First things first, unzip BobsESTKExtras.jsxbin.zip

Macintosh
On Mac, the ESTK is installed as a package. Its location is:
/Applications/Utilities/Adobe Utilities/ExtendScript Toolkit 2/ExtendScript Toolkit 2.app

Right click on the ESTK package, and select Show Package Contents.
A Finder window will appear that will contain a folder named Contents. This is a
normal finder window, you need to navigate to:
Contents/Shared Support/Required

You should see a bunch of scripts named like: 00globals.jsx, 01.startup.jsx, etc.
Place BobsESTKExtras.jsxbin in the Required folder.

Close the package contents Finder window.


Launch the ESTK. You should see a menu Extras added to the ESTK menubar
at the right end.

Windows
Place BobsESTKExtras.jsxbin into the folder:
C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit 2\Required

Launch the ESTK. You should see a menu Extras added to the ESTK menubar
at the right end.

Features
Currently the only ESTK Extra is Batch Export to Binary.

Batch Export to Binary


This extra allows you to select a folder. The extension will do a hierarchical
search for all JSX files contained in that folder with a few exceptions: Files
contained in a folder named Startup Scripts, jsx, or resources will be omitted
from processing.
When you select this menu, a Folder selection dialog will appear. Select the
folder that contains the JSX files you want to export to Binary. Click OK?.
Batch Export to Binary will then create a bin folder inside the folder you
selected. Each JSX file in the selected folder will be compiled to Binary and
then saved into the bin folder. including the relative path of the JSX file. The file
name of the compiled and exported file will be its original file name with the
jsxbin extension.
The goal is to make it easy to convert a project from JSX to JSXBIN. For
example, if you have a flag field in your startup script, binary = true, then the
loader code can load files from the bin folder.
The startup scripts folder is omitted so that you will not have a second startup
scripts folder as a bin (startup scripts should never be jsxbin!).

The resources folder is omitted as resources should be a place for things like
images and what not. If you choose to, you can put some test scripts in there.
Regardless, any jsx in a resources folder will not be converted.
The jsx folder is omitted because there are times when you have to ship a script
as a jsx. The best example is a class that will be serialized with toSource(). A
class that is defined in a jsxbin file can be serialized; however, its resulting JSON
code can not be re-instantiated with an eval() statement. So if your project
contains a class that will be serialized, place its source code in a folder named
jsx, and it will be left alone.
For example, if your folder structure looks like this:
/MyProject
script1.jsx
script2.jsx
/jsx
FileThatRemainsJSX.jsx
/Startup Scripts
ScriptLauncher.jsx
/ui
UIElement1.jsx
UIElement2.jsx
/uiWindow
UIWindow.jsx

The resulting structure will look like:


/MyProject
script1.jsx
script2.jsx
/bin
script1.jsxbin
script2.jsxbin
/ui
UIElement1.jsxbin
UIElement2.jsxbin
/uiWindow
UIWindow.jsxbin
/jsx
FileThatRemainsJSX.jsx
/Startup Scripts
ScriptLauncher.jsx
/ui
UIElement1.jsx
UIElement2.jsx
/uiWindow
UIWindow.jsx

Once done, you simply remove the JSX files, flip the switch in your loader code
to use the binaries, and youre done.

S-ar putea să vă placă și