Skip to content

Read-Eval-Print-Loop (REPL) for ExtendScript via Apple Javascript for Automation.

License

Notifications You must be signed in to change notification settings

theasci/extendscript-repl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Read-Eval-Print-Loop (REPL) for ExtendScript via Apple Javascript for Automation.

Requirements

  1. macOS supporting JavaScript for Automation
  2. Valid license for Adobe products that use ExtendScript. Currently supports Photoshop, Illustrator and InDesign.
  3. Ruby
  4. 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

  1. Backslashes (\) need to be escaped. jsx> 'test'.match(/\\w/)

NPM Release Tasks

  1. Update package.json version number
  2. npm install to update package lock.
  3. Ensure tests pass: npm test
  4. Update CHANGELOG.md with changes since last release.
  5. Check them all into the repository.
  6. git tag -a <version> -m <version>; git push --tags
  7. npm publish to deploy the release to npm.

TODO

  1. ExtendScript session to handle variables introduced. Not sure how this would be done.
  2. History writes to a file so they exist beyond a single Session
  3. Handle multiline commands

About

Read-Eval-Print-Loop (REPL) for ExtendScript via Apple Javascript for Automation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published