Scripts: app.redraw returns without changing the documents

A script that called app.redraw() stopped with an error, because app had
no such member. The call now returns undefined and adds no undo step. A
run works on its own copy of the documents, and the app draws the
documents as they were before the run until the run ends, so the call
has nothing new to draw.
This commit is contained in:
dotCooCoo committed 2026-11-24 23:58:24 -08:00
1 parent dc9adb195d
commit e45b922802
5 files changed
+32 -3

No files matched your search

+4 -2
View File
@@ -2622,7 +2622,7 @@ app through the global object `vc`, and writes to the Script Console and runs ot
- `vc.log(value)` adds a value to the report and a line to the Script Console.
- `app` is the application object the help page https://ai-scripting.docsforadobe.dev/jsobjref/Application/
describes: `app.documents`, `app.activeDocument` (assigning an open document makes it the active one),
`app.selection`, `app.coordinateSystem` and `app.getIsFileOpen(path)`. `app.documents`
`app.selection`, `app.coordinateSystem`, `app.getIsFileOpen(path)` and `app.redraw()`. `app.documents`
(https://ai-scripting.docsforadobe.dev/jsobjref/Documents/) has `length`, `[i]`, `index(key)`, `getByName(name)`
and `add(colorSpace?, width?, height?, numArtBoards?, artboardLayout?, artboardSpacing?, artboardRowsOrCols?)`,
which runs `file.new` (`artboardRowsOrCols` is the number of rows for `GridByCol` and `RLGridByCol`, and of
@@ -2692,7 +2692,9 @@ app through the global object `vc`, and writes to the Script Console and runs ot
with `selected`. `getIsFileOpen` compares the path with the open documents' files as text (in a Windows path,
letter case is ignored and `\` matches `/`) and does not resolve the path it is given. A document counts only when
the automation read roots allow its file, and that check can look the document's file up on disk. A path with
`..`, a network path, a NUL character or more than 4,096 bytes throws an error. Some members the Application,
`..`, a network path, a NUL character or more than 4,096 bytes throws an error. `app.redraw()` returns `undefined`
and does not change the documents or add an undo step. In the app, the documents are drawn as they were before the
run until the run ends, with or without the call. Some members the Application,
Document and PageItem pages list, such as `Document.layers`, `PageItem.blendingMode`, `PageItem.rotate` and
`app.beep`, throw an error that says they are not available yet when they are read or assigned. Other members
those pages list, such as `app.version` and `Document.save()`, and the members of the pages of the page-item kinds
+1
View File
@@ -1025,6 +1025,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s.
- 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: `app.redraw()` (https://ai-scripting.docsforadobe.dev/jsobjref/Application/) returns without changing the documents or adding an undo step; the app goes on drawing the documents as they were before the run until the run ends. VectorCraft's own rule. `crates/engine/src/tests/script_dom.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`.