Skip to content

Scripting: run scripts written for Illustrator (object model, .jsx, AppleScript, VBScript) #1210

Open

Description

@LloydNicholson

VectorCraft's scripting (#1161, PR #1183) runs .js files written against VectorCraft's own commands, through a global vc object. Scripts written for Adobe Illustrator don't run. Illustrator accepts these script types (Adobe: Install and run scripts, scripting guide):

Script type Status in VectorCraft
JavaScript / ExtendScript (.jsx, .js) using Illustrator's object model (app.activeDocument, pathItems, swatches…) The language runs (Boa), but the object model doesn't exist, so these scripts fail at their first Illustrator call
Compiled ExtendScript (.jsxbin) Not read
AppleScript (.scpt, .applescript, macOS) VectorCraft can already be driven from AppleScript (see below), but scripts written for Illustrator (tell application "Adobe Illustrator") don't run unchanged: there is no scripting dictionary with Illustrator's object model
VBScript (.vbs, Windows) VectorCraft can already be driven from VBScript (see below), but scripts written for Illustrator (CreateObject("Illustrator.Application")) don't run unchanged: there is no COM interface with Illustrator's object model

What already works from other scripting languages

VectorCraft doesn't need OS automation to be controlled:

  • Files, without the app open: vectorcraft-cli (run, convert, script FILE.js [DOCUMENT] --out … --arg …) can be called from AppleScript's do shell script, from VBScript's WScript.Shell, or from any shell or language. It works in its own process, on files.
  • The open document in a running app: vectorcraft --control PORT takes JSON lines on 127.0.0.1 (docs/control-protocol.md); any command can run, including ui.runScript {path}. vectorcraft-cli mcp --connect gives agents the same through MCP. The port is off unless the app is started with --control.

So this issue is about compatibility with existing Illustrator scripts, not about being scriptable at all.

Why it's separate

Running existing Illustrator scripts would need a compatibility layer: Illustrator's scripting object model rebuilt over VectorCraft's command registry. That model is large (documents, layers, page items, paths, text frames, colours, swatches, symbols, export options and more), and scripts rely on its exact behaviour. The clean-room rules in AGENTS.md limit behaviour sources to public documentation, so whether and how to build it from Adobe's published scripting reference is a maintainer decision.

Options

  1. ExtendScript object-model shim: expose app, Document, PathItem… as JavaScript objects, written from the public scripting reference and implemented with vc.run and document.inspect. It could start from the subset common scripts use (documents, layers, paths, fills, selection, export) and grow from there. .jsx would then be offered in File › Scripts.
  2. ExtendScript extras: #include, #target, $.writeln, ScriptUI dialogs and File/Folder access, each a separate decision. File access in particular would need to respect the automation roots.
  3. Native OS interfaces for unchanged Illustrator AppleScript/VBScript: an AppleScript dictionary on macOS and a COM server on Windows that offer the same object model. These are separate projects with their own security questions. AppleScript and VBScript can already control VectorCraft through the CLI and the control port, so this matters only for running Illustrator's own scripts.
  4. .jsxbin: likely out of scope (an Adobe-specific encoded format).

Not in scope of #1183

PR #1183 deliberately ships only VectorCraft's own .js API, plus File › Scripts' folder listing and recent scripts. This issue tracks the rest. It belongs to gap G6 (docs/gaps.md); the Automation row in docs/target-app-parity.md lists "Illustrator's scripting object model" as missing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions