# ScalaTools — install & run (InDesign CS6 → latest, macOS + Windows)

## Install (per InDesign version — paths are version+language specific)

1. In InDesign: **Window > Utilities > Scripts** to open the Scripts panel.
2. Right-click the **User** folder → **Reveal in Finder** (Mac) / **Reveal in Explorer** (Windows).
   This opens the exact `Scripts Panel/` folder for *this* host version/language.
3. Copy the whole **`ScalaTools/`** folder (this directory, incl. `lib/`) into that
   `Scripts Panel/` folder. Subfolders appear as groups in the panel.
4. The scripts now appear under **ScalaTools** in the Scripts panel; double-click
   `01_ScaleGraphics.jsx` to run.

### Path reference (if Reveal is unavailable)

- **macOS (per-user):**
  `~/Library/Preferences/Adobe InDesign/<version>/<language>/Scripts/Scripts Panel/`
- **Windows (per-user):**
  `C:\Users\<user>\AppData\Roaming\Adobe\InDesign\<version>\<language>\Scripts\Scripts Panel\`
- **All users (needs admin):** the InDesign install folder's `Scripts\Scripts Panel\`.

`<version>` (e.g. `8.0` for CS6, `19.0`, `20.0`) and `<language>` (e.g. `en_US`,
`ru_RU`) change per release — there is NO shared folder, so copy into each version
you use. Never hardcode these paths in an installer; always locate via **Reveal**.

## Run

- Open a document, optionally select frames (for Scope = Selection),
  double-click `01_ScaleGraphics.jsx`. Default filter is prefix `equ`
  (MathType formula EPS). Use **Preview count** before OK.

## In-host self-tests (optional, proves ES3 parity)

From the Scripts panel run any of:
`tests/inhost/namematch.assert.jsx`, `worklist.assert.jsx`, `scale.assert.jsx`,
`manifest.assert.jsx`. Each `//@include`s the libs it needs and ends with an
alert showing `... passed, 0 failed` (the running tally is cumulative within a
single ExtendScript engine session — restart the engine, or run one file at a
time, for a per-suite count).

The same logic is verified in CI without InDesign via the Node mirror harness:

```
node jsx/ScalaTools/tests/run-node.js
```

## Notes

- Ship **plain `.jsx`** only — never `.jsxbin` (bytecode is version-locked and the
  compiler/ESTK no longer exists on modern macOS).
- The script pins `app.scriptPreferences.version = 8.0` while running and restores
  it afterward, so it behaves identically across CS6→latest.
- UTF-8: keep these files UTF-8 encoded. All non-ASCII characters in the source
  (e.g. the em dash in the dialog title) are written as `\uXXXX` escapes so the
  files stay byte-for-byte ASCII and cannot mojibake regardless of how a host
  reads them.
