extendscript-repl
v0.0.4
Published
Read-Eval-Print-Loop (REPL) for ExtendScript
Downloads
4
Readme
Overview
Read-Eval-Print-Loop (REPL) for ExtendScript via Apple Javascript for Automation.
Requirements
- macOS supporting JavaScript for Automation
- Valid license for Adobe products that use ExtendScript. Currently supports Photoshop, Illustrator and InDesign.
- Ruby
- Handy ExtendScript reference
Installation
Clone and use directly:
git clone https://github.com/theasci/extendscript-repl
cd extendscript-repl
./run.rb -h
Or, add as development dependency in your package.json
file.
"devDependencies": {
"extendscript-repl": "^0.0.1"
}
Install with npm install
. You should now be able to create a script (repl.sh
) that loads your bootstrap JSX, if desired.
#!/bin/bash
DIRECTORY=$(cd `dirname $0` && pwd)
"$DIRECTORY/node_modules/extendscript-repl/run.rb" -b "$DIRECTORY/bootstrap.jsx"
run.rb
me@host$ ./run.rb -a photoshop
ExtendScript REPL - photoshop
Type 'help' to get started.
jsx> app.name
Adobe Photoshop
jsx> app.version
21.0.3
jsx> exit
me@host$ ./run.rb -a indesign
ExtendScript REPL - indesign
Type 'help' to get started.
jsx> app.properties.name
Adobe InDesign
jsx> app.properties.version
15.0.1.209
jsx> app.activeDocument.stories[0].texts.firstItem()
Application("Adobe InDesign 2020").documents.byId(510).stories.byId(216)
jsx> app.activeDocument.stories[0].texts.firstItem().toSpecifier()
/document[@id=510]/story[0]/text[@location=first]
jsx> quit
me@host$ ./run.rb -b lib/bootstrap.jsx
jsx> Global.toSource()
({rootPath:new Folder ("~/projects/extendscript-repl")})
jsx> Global.rootPath
Path("/Users/me/projects/extendscript-repl")
Gotchas
- Backslashes (\) need to be escaped.
jsx> 'test'.match(/\\w/)
NPM Release Tasks
- Update
package.json
version number npm install
to update package lock.- Ensure tests pass:
npm test
- Update
CHANGELOG.md
with changes since last release. - Check them all into the repository.
git tag -a <version> -m <version>; git push --tags
npm publish
to deploy the release to npm.
TODO
- ExtendScript session to handle variables introduced. Not sure how this would be done.
- History writes to a file so they exist beyond a single Session
- Handle multiline commands