0% found this document useful (0 votes)
187 views3 pages

Batch Convert JSX to JSXBIN Utility

BobsESTKExtras provides utilities for developing Adobe Creative Suite 3 applications in JavaScript. It includes extras that allow batch conversion of JavaScript (JSX) files to binary (JSXBIN) files for faster loading. The batch converter searches a folder hierarchy for JSX files, excluding those in "Startup Scripts", "jsx", or "resources" folders, and compiles/saves corresponding JSXBIN files in a new "bin" folder while maintaining the file paths.

Uploaded by

Abhinav Nigam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views3 pages

Batch Convert JSX to JSXBIN Utility

BobsESTKExtras provides utilities for developing Adobe Creative Suite 3 applications in JavaScript. It includes extras that allow batch conversion of JavaScript (JSX) files to binary (JSXBIN) files for faster loading. The batch converter searches a folder hierarchy for JSX files, excluding those in "Startup Scripts", "jsx", or "resources" folders, and compiles/saves corresponding JSXBIN files in a new "bin" folder while maintaining the file paths.

Uploaded by

Abhinav Nigam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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 [Link]

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

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: [Link], [Link], etc.
Place [Link] 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 [Link] 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
[Link]
[Link]
/jsx
[Link]
/Startup Scripts
[Link]
/ui
[Link]
[Link]
/uiWindow
[Link]

The resulting structure will look like:


/MyProject
[Link]
[Link]
/bin
[Link]
[Link]
/ui
[Link]
[Link]
/uiWindow
[Link]
/jsx
[Link]
/Startup Scripts
[Link]
/ui
[Link]
[Link]
/uiWindow
[Link]

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

You might also like