mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 05:53:08 -05:00
Scripts: Document.print sends to a printer after the run and the person's approval, and app.printerList lists printers
Document.print without jobOptions.file now prints to the printer that PrintOptions.printerName names, or to the default printer. A run started in the app gets a bounded list of the print service's printer names (at most 256, names up to 512 bytes, no control characters), and app.printerList gives a Printer object for each. A name must match a listed printer exactly. print composes each job as a print-ready PDF and holds it until the run ends. When the run's changes are kept, a dialog lists each job's document, printer and pages, and only the person at the keyboard can choose Print: ui.dialog.confirm and synthetic input are refused. Cancel drops the jobs. A failed or stopped run sends nothing, and no job is sent if one of its printers is no longer installed. A run prepares at most 4 jobs, 100 pages and 32 MiB, and pages are counted before a job is composed. The web, MCP and the command line cannot print to a printer from a script. Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
1 parent
1b429b586e
commit
b965a3ef1f
17 files changed
+902
-51
No files matched your search
+24
-4
@@ -2743,8 +2743,27 @@ app through the global object `vc`, and writes to the Script Console and runs ot
|
||||
`FontSubstitutionPolicy`, `PageMarksTypes`, `PostScriptImageCompressionType` and `PrinterPostScriptLevelEnum` hold
|
||||
strings such as `"PrintTiling.TILEFULLPAGES"`. VectorCraft's own rules: `print` writes the file `jobOptions.file`
|
||||
names, checked as `saveAs` checks its file: PostScript when the name ends with `.ps` or `postScriptLevel` is
|
||||
assigned, a print-ready PDF otherwise. Without a file it throws `Printing to a printer is not available to scripts
|
||||
yet`, and `app.printerList` throws an error that says it is not available yet. `fitToPage` set to true wins over
|
||||
assigned, a print-ready PDF otherwise, and `printerName` does not apply. Without a file, `print` prints to the
|
||||
printer `printerName` names, or to the system's default printer when it is `""` or not assigned
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/). The name must be exactly the name of a printer the
|
||||
app listed for the run, or `print` throws `PrintOptions.printerName names no installed printer`; with no default
|
||||
printer it throws `There is no default printer`. `print` composes the job as a print-ready PDF when it is called
|
||||
and sends nothing while the run goes on. When the run ends and its changes are kept, the app asks before it sends
|
||||
the jobs (dialog kind `scriptPrint`, listing each job's document, printer and pages). Only the person at the
|
||||
keyboard can choose Print: `ui.dialog.confirm` and synthetic input are refused, and the dialog stays open. Cancel,
|
||||
Escape and `ui.dialog.cancel` drop the jobs and keep the run's changes. A run that fails or is stopped sends
|
||||
nothing. Before it sends them, the app checks that each printer is still installed under that name, and sends none
|
||||
when one is not. A run prepares at most 4 jobs, together at most 100 pages, every copy counted, and 32 MiB, and
|
||||
none while an earlier run's jobs wait for an answer. A job for a printer is a PDF, so `postScriptLevel` with no
|
||||
file throws. Where the app lists no printers for scripts (the web, MCP or the command line without the app),
|
||||
`print` with no file throws `Printing to a printer is not available here`. `app.printerList` gives a `Printer` for
|
||||
each printer the app listed for the run, at most 256, leaving out names longer than 512 bytes or with a control
|
||||
character (https://ai-scripting.docsforadobe.dev/jsobjref/Application/,
|
||||
https://ai-scripting.docsforadobe.dev/jsobjref/Printer/). Its `name` is read-only and its `printerInfo` throws an
|
||||
error that says it is not available yet. With no document open, `app.printerList` throws `Application.printerList
|
||||
needs an open document`, as the Printer help page describes, and where the app lists no printers for scripts it
|
||||
throws `Application.printerList is not available here`. A printer name is only compared with the listed names: it
|
||||
is never read as a path, a URL or a command. `fitToPage` set to true wins over
|
||||
the scale factors and the tiling mode. With `printAllArtboards` false, `artboardRange` picks the artboards, and
|
||||
without a range every artboard prints. With one of `horizontalScale` and `verticalScale` assigned, the other keeps
|
||||
the document's saved value. `print` throws before anything is written when an assigned `artboardRange` names an
|
||||
@@ -2753,7 +2772,7 @@ app through the global object `vc`, and writes to the Script Console and runs ot
|
||||
case), when `paperOptions.name` is not a paper `file.print` knows, or when it names a paper other than `custom`
|
||||
and `width` or `height` is assigned above 0. An assigned name that is empty or only
|
||||
spaces, or holds `/`, `\` or a control character, throws too, and each checked name is sent without the spaces
|
||||
around it. `printerName` and `PPDName` take only `""`. A listed option that is not mapped, or a value that is not mapped such as
|
||||
around it. `PPDName` takes only `""`. A listed option that is not mapped, or a value that is not mapped such as
|
||||
`PrintingBounds.ARTWORKBOUNDS`, `INRIPSEPARATION`, `PSLEVEL1` or a scale above 1000, throws an error that says it
|
||||
is not available yet. Each value is checked when it is assigned: a wrong type, a number that is not finite or is
|
||||
out of range, a string longer than 4,096 bytes, an option object of the wrong class or from an earlier run, and a
|
||||
@@ -2959,7 +2978,8 @@ In the app, a script past the growth limit stops at a question to continue or to
|
||||
`ui.dialog.cancel` all stop the run. A run with nobody to ask, such as a call over MCP or the command line, ends
|
||||
with an error at that limit. The headless reply is `{ok: true, name, changed, written, log, fuelUsed, hostCalls,
|
||||
runTimeMs, timingAvailable, hostCallCounts, slowestCommands, console, dialogs, dialogCount, dialogsTruncated}`. In
|
||||
the app the reply is `{running: true, name}`, and the report appears later as `scriptReport` in `ui.inspect`. The
|
||||
the app the reply is `{running: true, name}`, and the report appears later as `scriptReport` in `ui.inspect`, with
|
||||
`prints`, the number of jobs the run prepared for a printer, when it prepared any. The
|
||||
report of a failed run has the same fields after `kind`, `message`, `messageOrigin`, `line`, `column`, `file` (when
|
||||
the error is in another file than the script) and `fuelLeft`. `messageOrigin` is `script` when `message` is text the
|
||||
script supplied (a value it threw, or an error it made or whose name or message it changed) and `built-in` for the
|
||||
|
||||
@@ -1026,7 +1026,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`.
|
||||
- Scripts: the global `app` gives the open documents, new documents from a startup preset and a `DocumentPreset`, the active document, each document's selection and its page items with their names, notes, visibility, lock, opacity, position, size, bounds and stacking order, and moves and copies them into or beside other objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Application/, https://ai-scripting.docsforadobe.dev/jsobjref/Documents/, https://ai-scripting.docsforadobe.dev/jsobjref/DocumentPreset/, https://ai-scripting.docsforadobe.dev/jsobjref/Document/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItem/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ describe them; each change runs a command inside the run's transaction (`docs/mcp.md`). Layers, paths, type and the other classes are not there yet. `crates/engine/src/tests/script_dom.rs`.
|
||||
- Scripts: `Document.saveAs`, `Document.exportFile` and `app.open` save, export and open documents with the option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/IllustratorSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/EPSSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/PDFSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsPNG24/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsJPEG/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsSVG/ and https://ai-scripting.docsforadobe.dev/jsobjref/PDFFileOptions/ describe, and read and write only where the script's `File` objects may (`docs/mcp.md`). `crates/engine/src/tests/script_save_open.rs`.
|
||||
- Scripts: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets. Printing to a printer from a script and `app.printerList` are not available yet (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`.
|
||||
- Scripts: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`.
|
||||
- Scripts: `Document.print` without a file prints to the printer `PrintOptions.printerName` names, or the default printer, and `app.printerList` lists the installed printers as `Printer` objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/Application/ and https://ai-scripting.docsforadobe.dev/jsobjref/Printer/ describe. VectorCraft's own rules: the jobs are sent after the run's changes are kept and the person at the keyboard approves them, nothing is sent from a failed run, and the web, MCP and the command line cannot print to a printer from a script (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`, `crates/ui-egui/src/tests/script_print.rs`.
|
||||
- Scripts: Window › Script Console shows each run's `$.write` and `$.writeln` output, `vc.log` entries, uncaught error with the script's name, line and column, and a report of its time, host calls and slowest commands, keeping at most 2,048 lines and counting the lines it dropped. `script.run`'s report carries the same data, and `script.console`, `script.console.clear` and `ui.copyScriptConsole` read, clear and copy it. `crates/engine/src/tests/script_console.rs`.
|
||||
- Scripts: the status bar translates its own words around a failed run's error and the app's own error messages, and shows text the script threw itself (a value, an error it made, or an error whose name or message it changed) as it is, even when that text reads like one of the app's messages. `script.run`'s report gives `messageOrigin` (`script` or `built-in`), and the advice about objects other applications give their scripts follows only the app's own reference errors. VectorCraft's own rule. `crates/js/src/interp_tests.rs`, `crates/engine/src/tests/script_run.rs`, `crates/ui-egui/src/chrome/tests.rs`.
|
||||
- Scripts: the `$` object has the other members the Dollar object page lists (https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/), from `$.about()` to `$.version`, and scripts have the global `localize(object, ...values)` (https://extendscript.docsforadobe.dev/extendscript-tools-features/localizing-extendscript-strings/), `toSource(value)` and `Object.prototype.toSource()`. Each run starts with the interface's locale, and what a script changes in `$` lasts only for that run. `crates/engine/src/tests/script_dollar.rs`, `crates/js/src/extension_tests.rs`.
|
||||
|
||||
Reference in new issue
Block a user