Commit Graph
104 Commits
Author SHA1 Message Date
dotCooCoo 79ef692ce5 Scripts: palette events keep their checks after getters and print questions
- paletteClose with another engine's palette id no longer drops that
  palette's waiting events.
- A hidden palette is not described after a run or an add, so a
  throwing getter on it no longer fails the run; script.palettes and
  docs/mcp.md say a hidden palette lists its controls as they were.
- A check box's click rechecks the box after reading its value, so a
  getter that disables it or closes the palette stops the click.
- A list's change rechecks that the list is still enabled and visible
  after its item texts are read, and is dropped when a getter disabled
  or hid it.
- A waiting palette event does not start its run, or ask for frames,
  while the last run's print jobs wait for their answer.
- script.palette.event's help states that a change merges only after
  its palette's last waiting click or close.
2026-12-02 17:05:59 -08:00
dotCooCoo e1558e7e4a Merge main into feat/scripts-scriptui-palettes 2026-12-02 15:27:42 -08:00
dotCooCoo 930c02ce8f Merge main into feat/scripts-pageitem-transforms 2026-12-02 12:20:10 -08:00
dotCooCoo 46b0d0def6 Merge main into feat/scripts-scriptui-palettes 2026-12-02 12:08:01 -08:00
dotCooCoo 2cf9f56194 Scripts: palette events keep their file access, hide and enabled checks
- update() takes a waiting palette event only when the run's file access
  roots reach the same files as the event's, so a handler never runs with
  less access than its palette was shown with.
- A palette event is no longer delivered to a handler after its palette
  was hidden and shown again, or after a capturing listener disabled or
  hid the control or a group above it.
- A limit that ends a handler update() took restores the run's own
  actions before the end-of-run refresh.
- A palette refresh that fails reports no unhandled rejection.
- A refused palette field text no longer replaces text typed after it.
- The script.run, script.palette.event and docs texts describe update()
  delivery, list staleness after item edits, and repeating a click or
  close dropped with an oversized text.
2026-12-02 10:49:08 -08:00
dotCooCoo 31d02e4821 Scripts: startup scripts at launch list no printers, and spool failures stay shown
The startup scripts run at launch no longer list the print service's
printers, so the first window does not wait on it; a script.startup.run
with any other reason still lists them. A script's print jobs that the
desktop's worker fails to send are shown in the status bar even when a
later line, a later batch that was sent or a startup script's failure
took it, and the startup script's notes stay in the hover.
script.startup.run's params text describes the print wait and the
launch rule.
2026-12-02 07:39:44 -08:00
dotCooCoo e61533b320 Merge main into feat/scripts-pageitem-transforms 2026-12-02 05:28:03 -08:00
dotCooCoo 2fa0dccc39 Merge main into feat/scripts-scriptui-palettes 2026-12-02 02:48:47 -08:00
dotCooCoo 666f7e3db2 Scripts: a palette click is dropped when a later getter disables its button
A getter read after a button while the palette was described could
disable or hide the button, or a group above it, after the description
recorded it as enabled, and the click still ran its handler.

- Palette states are read without running a getter, once every
  description getter (the default and cancel elements included) has
  run, and a state that a getter gives counts as off. Dialogs keep
  reading the states through their getters.
- Delivering a palette event reads the states of the control and the
  groups above it again the same way, and checks that the palette still
  holds the control, before the handler runs.
- docs/mcp.md, the progress line and script.palette.event's params text
  describe the rule.
2026-12-02 01:54:08 -08:00
dotCooCoo f01f2ce6c0 Fix #10463: $.evalFile reads File URI paths
File.parent gives a folder in URI notation (/c/Users/..., with %20 for a
space). $.evalFile joined that text to the script's folder as written, so
on Windows $.evalFile(File($.fileName).parent + '/more.jsx') looked under
C:\c\Users\... and reported "include file not found".

When an absolute path starting with one / names no file the script may
read, $.evalFile now also tries it with its escapes decoded and, on
Windows, with /c/... as the drive C:. The path as written is still tried
first, and the scope check, the .. refusal and the file limits apply to
every form. Share and device paths are not converted, and #include lines
are read as before.
2026-12-01 09:30:34 -08:00
dotCooCoo 7b3690163e Scripts: palette events report their own run, and dialogs keep typed texts on a failed handoff
- script.palette.event with nobody to ask answers with the report of the
  run that handled the given event, also when it took the place of an
  earlier waiting event or a run of its engine took it with update(); an
  event dropped without a run is an error, and a later event that cannot
  start leaves the given event's result. An open drag in a document other
  than the active one is refused before the event waits, and the app's
  palette start check uses the same rule.
- A palette event's handler and the refresh after a run take no waiting
  event through update(), so a later event does not run inside them. The
  refresh after a named run spends at most the unbroken-run allowance.
- A click whose button a getter removed during the event runs no handler.
- A window answer that could not reach the script lists the dialog with
  the answer "error" instead of "stop".
- In a ScriptUI dialog, Escape, ui.dialog.cancel and a click keep the typed
  texts when the run does not take the event, and a refused event asks for
  the next frame so the queued events after it go on.
- Quitting while only palettes are open asks whether to stop the run.
2026-11-30 03:31:54 -08:00
dotCooCoo 48b59a3ccc Scripts: palette events and typed texts keep their own file access scope
A waiting palette event merges with a newer one only when both have the
same file access scope, and a click or close merges only after its
palette's last waiting change. A text typed in a field keeps the scope
of each pass that edited it and goes to the script under what both that
scope and the committing pass allow; a click or close that commits it
takes those limits too. Passes recorded before the app takes them stay
separate. Scope coverage checks root containment instead of comparing
the same roots object, and the progress line describes when update()
runs a waiting event.
2026-11-29 21:28:02 -08:00
dotCooCoo c0eb5b898b Merge main into feat/scripts-pageitem-transforms
PathItem now takes PageItem's translate, rotate and resize: main's PathItem versions are removed, and resize on a path keeps main's changeLineWidths percent for the stroke weight. Hidden objects are refused, and an identity transform of an empty path checks its Transformation value and does nothing.
2026-11-29 17:19:24 -08:00
dotCooCoo 4929a4beb6 Merge main into feat/scripts-scriptui-palettes 2026-11-29 10:23:01 -08:00
dotCooCoo cb75bb73fc Merge main into feat/scripts-app-undo-redo
# Conflicts:
#	crates/engine/src/cmd/scripts.rs
2026-11-28 20:45:40 -08:00
dotCooCoo cac93ca107 Merge main into feat/js-es2015-modules 2026-11-28 20:44:06 -08:00
dotCooCoo 8c668944d1 Scripts: name app.undo and app.redo in script.run's help, and leave file.new's messages to their own change
script.run's params text now says what app.undo() and app.redo() do. The artboardLayout messages,
their test and their catalog rows go back to main's text; they belong to file.new rather than to
script history.
2026-11-28 19:51:50 -08:00
dotCooCoo 3e2a615aee Merge main into feat/js-es2015-modules 2026-11-28 19:45:10 -08:00
dotCooCoo c6342cec0d Merge main into feat/scripts-pageitem-transforms 2026-11-28 18:32:46 -08:00
dotCooCoo f48c493551 Merge main into feat/scripts-scriptui-palettes 2026-11-28 18:24:09 -08:00
dotCooCoo e2c4d0bbbe Merge main into feat/scripts-api-d9-do-script 2026-11-28 14:28:32 -08:00
dotCooCoo 02ef75749e Merge main into feat/scripts-api-d1b-prefs-matrix-clipboard
# Conflicts:
#	crates/engine/src/cmd/scripts.rs
#	crates/engine/src/script/dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	crates/ui-egui/src/tests/script_run.rs
2026-11-28 14:26:05 -08:00
dotCooCoo 1d3e835927 Scripts: ScriptUI review fixes for heap-limit adds and removes, listeners, list texts, Enter, the run's questions and automation requests
- Adding a control or an item, and removing items, builds both arrays
  before the first write, so a run that ends at the heap limit leaves the
  lists and the dialog's counts as they were.
- A listener registered after an event started does not hear it in a later
  phase, a capturing container's re-registration included.
- show() reads the dialog again when a getter changes a list item's text
  after the item was read.
- Enter and Escape skip an OK or Cancel button inside a hidden or disabled
  container.
- A resource string of a name and a type without braces throws a
  SyntaxError, and a \u escape pair of surrogates reads as one character.
- In the app, queued events wait while another dialog is open over the
  script's dialog, and the run's own questions wait while a popup, such as
  an open drop-down list, is over it. ui.dialog.confirm and
  ui.dialog.cancel take only the dialog, ui.dialog.set needs a field or an
  action and answers with the dialog it set, and OK is refused while a
  dialog open over it waits. A cancel after typed text clicks the cancel
  button the dialog has when its turn comes, and an immediate cancel the
  run refuses is an error.
- A click on a list box row gives the list the keyboard focus.
- The vc hint test names BridgeTalk, since Window now exists; the params
  text and docs/mcp.md say that a show() in a handler notify runs throws
  only in the app, and define_script_ui says when end is not called.
2026-11-28 02:43:06 -08:00
dotCooCoo a9799bfe9a Merge main into feat/scripts-scriptui-resources 2026-11-27 22:17:49 -08:00
dotCooCoo 4f51dabdd7 Merge main into feat/scripts-scriptui-palettes
# Conflicts:
#	crates/engine/src/script/mod.rs
#	crates/engine/src/tests.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	crates/js/src/interp.rs
#	crates/js/src/lib.rs
#	crates/ui-egui/src/dialogs/script_run.rs
#	crates/ui-egui/src/script_runs.rs
2026-11-27 22:12:18 -08:00
dotCooCoo 54500d1025 Merge main into feat/scripts-api-d1b-prefs-matrix-clipboard 2026-11-27 22:12:06 -08:00
dotCooCoo ac3056e829 Merge main into feat/scripts-api-d9-do-script 2026-11-27 22:00:04 -08:00
dotCooCoo a354d09af4 Scripts: folder listings take their time limit from the session's clock
script::folder::list and script::startup::list measured the 250 ms
listing limit (MAX_SCAN) with a real Instant. script.listInstalled,
script.startup.run and the File > Scripts menu read the folders through
them, so a test that went through any of these got a truncated listing
and missing scripts whenever the disk stalled for 250 ms.

- folder::Clock is either Wall (the real time since the listing started,
  the default) or Fixed (the same time at every check). Both list
  functions take one.
- Session::set_script_listing_clock sets the clock the two commands and
  the menu's listing job use; the app keeps the real clock.
- The script folder, startup script, scripts menu, script run and Safe
  Mode tests list with a fixed zero time, so a slow disk cannot cut a
  listing short. Direct listing calls use the test file's list helper.
- New tests check that script.listInstalled, script.startup.run and the
  menu stop at the session's clock once it is past the limit and list
  everything at the limit.
2026-11-27 16:10:28 -08:00
BFlat 023843e3a6 Merge pull request #9114 from dotCooCoo/feat/scripts-startup-scripts
Scripts: run startup scripts at launch and before a chosen script
2026-11-27 05:13:16 +07:00
dotCooCoo ca68753463 Keep startup queue failures and stop requests consistent 2026-11-26 10:37:22 -08:00
dotCooCoo 7da21d015c Validate and retain chosen scripts before startup runs 2026-11-26 08:56:39 -08:00
dotCooCoo 844980f135 Scripts: read the chosen script once when startup scripts are skipped
The chosen script is prepared only after the skip check, so a skipped round leaves its read to script.run. The new startup tests use a TempDir that removes the folder when the test ends.
2026-11-25 23:58:46 -08:00
dotCooCoo 65da2f2c4f Merge main into feat/scripts-api-d1b-prefs-matrix-clipboard 2026-11-25 22:32:12 -08:00
dotCooCoo 9aca0e1215 Merge main into feat/js-es2015-modules 2026-11-25 22:13:03 -08:00
dotCooCoo d8ee88ad82 Merge main into feat/scripts-api-d9-do-script 2026-11-25 20:50:31 -08:00
dotCooCoo 48357310ad Merge feat/scripts-scriptui-dialogs into feat/scripts-scriptui-resources 2026-11-25 20:43:55 -08:00
dotCooCoo 83184e76bd Scripts: stopping from the quit prompt between startup runs drops the queued runs
A startup script refused before it begins, such as with an undo group
open, is named in the Script Console. Stopping the runs from the quit
prompt between two queued runs drops the runs not yet started, and the
status bar says so. While that prompt is open, or before its answer is
taken, the next run does not start.
2026-11-25 17:33:55 -08:00
dotCooCoo 6ad8c0476a Scripts: script.grants.revoke removes only the grant named as given
script.grants.revoke matched a path both as given and with its links
followed, so revoking a grant whose path is now a link to another
granted path removed both grants. The spellings are now tried in order,
the path as given first, and only the first script and path pair that
some grant holds is removed.
2026-11-25 15:13:55 -08:00
dotCooCoo c0487189bd Scripts: check then's parameters and keep a failed startup script's message
script.startup.run checks then's parameters as script.run checks them,
before any startup script runs. In the app, the message of a startup
script that fails or is stopped, through the quit prompt too, stays in
the status bar's notes after the chosen script ends.
2026-11-25 13:49:06 -08:00
dotCooCoo 08638f5859 Merge feat/scripts-scriptui-dialogs into feat/scripts-scriptui-palettes 2026-11-25 11:30:03 -08:00
dotCooCoo 73978a194f Scripts: script.grants.revoke matches a path as given as well as resolved
A grant whose path a link has since replaced is listed by script.grants
under the path it was kept for, but script.grants.revoke followed the
link and compared the link's target, so Revoke in Script File Access
removed nothing. A path is now matched as given and, inside the
automation read roots, also with its links followed.
2026-11-25 10:00:05 -08:00
dotCooCoo f906a0f814 Merge main into feat/scripts-startup-scripts 2026-11-25 09:16:13 -08:00
dotCooCoo ddfeaef890 Merge main into feat/scripts-scriptui-dialogs 2026-11-24 23:37:30 -08:00
dotCooCoo 99df55dda2 Scripts: docs say a ScriptUI handler in the app cannot open alert, confirm, prompt or a file dialog 2026-11-24 20:31:53 -08:00
dotCooCoo aa8c9b8d36 Scripts: ScriptUI builds windows and controls from resource strings
new Window() and add() threw that resource specifications were not
available yet. They now read a resource specification in place of the
type, as
https://extendscript.docsforadobe.dev/user-interface-tools/resource-specifications/
describes it: a type, then braces holding `name: value` properties,
where `name: Class { ... }` defines a control.

- `crates/js/src/scriptui_resource.rs` reads `[name:] Type { ... }`.
  A value is null, true, false, a quoted string, a number, an inline
  array or an inline object. The commas between properties may be left
  out, as in the page's own example. A malformed specification throws a
  SyntaxError. One longer than 1 MiB or nested more than 64 deep throws
  a RangeError; these limits are VectorCraft's own.
- With a resource specification, new Window() and add() read no other
  argument. `properties` gives the creation properties. Each control in
  the braces is added through add(), with its limits of 512 controls
  nested 16 deep, and set as the container's property of its name. A
  list's `items` gives its item texts, as add()'s third argument does.
  Each other value is assigned to the property of its name. Palettes and
  windows still throw that they are not available yet.
- The script.run params text, docs/mcp.md and the Scripts line in
  docs/target-app-parity.md describe resource specifications.
2026-11-24 17:29:22 -08:00
dotCooCoo 46478976ce Scripts: a window answer names a control by its text only when the control has no name
A headless window step whose control matched no name fell back to the
first control with that text, even when that control had a name of its
own, so a step could reach a different control than the one it named.
The text now matches only controls without a name.
2026-11-24 17:20:38 -08:00
dotCooCoo e5d3c9a7fc Scripts: a dialog listener's close(result) decides show() for the default button
- When a click on the default or cancel button has no handler of the button's
  own, a listener on a container that calls close(result) now decides what
  show() returns; before, the button's result 1 or 2 replaced it.
- An event on objects made to look like controls whose parents form a cycle
  ends with a TypeError once the chain is longer than a dialog's nesting
  allows, instead of walking the cycle until the run's fuel is gone.
- The Run Script params text says that an unknown event type throws, and the
  progress line says that only the dialog takes a show listener.
2026-11-23 13:26:13 -08:00
dotCooCoo 66f081428a Scripts: queued ScriptUI events follow their control by id after a handler removes one
- Each ScriptUI element gets an id that the dialog's description carries. The
  app keeps a queued click or change, and each typed text, with its control's
  id instead of the control's position in its container, so a handler that
  removes a control no longer sends a later click or typed text to the control
  that moved into its place. An event whose control was removed is dropped,
  and so is a queued list change when a handler changed the list's items.
- A container that no longer holds the control when its turn comes does not
  get the event, and a listener that an earlier one removed in the same event
  does not run. The containers above the target stay kept from collection
  while the listeners run.
- A removed control and the controls it holds have no `window`; `removeAll`
  throws on them like `add` and `remove`.
- Every element starts with its listener list, which a script cannot replace,
  and `remove` and `removeAll` refuse an object made to look like an element
  of a real dialog.
- docs/mcp.md says a group takes its properties fourth when the third argument
  is not an object, as the code does.
2026-11-23 13:08:15 -08:00
dotCooCoo 3089ed73a5 Scripts: ScriptUI listeners are limited and removed controls leave their dialog
- A control with alignment fill stays within its maximumSize when its
  container's room is larger.
- A window or control takes at most 256 event listeners (VectorCraft's
  own limit); one more throws a RangeError. A show listener can be
  added only to the dialog, and on a control it throws an Error.
- A capturing listener on a container that stops a click keeps the
  default or cancel button from closing the dialog. Listeners on the
  containers that do not capture still leave the button to close it.
- stopPropagation() acts only on an event whose listeners are running,
  and preventDefault() does nothing, since the events are not
  cancelable.
- A control removed from its container has no parent, its events no
  longer reach the containers it was in, and add and remove on it, or
  on a control it holds, throw an Error. Its controls are no longer
  counted toward the dialog's limits.
- remove(text) throws an Error, and removes nothing, when a text getter
  changes the list or container while it looks for a match.
- A group takes its creation properties fourth again when the third
  argument is not an object, as in add("group", undefined, undefined,
  {name: "g"}).
- A click on a radio button now turns off only the radio buttons of its
  set, the ones added next to it with no other kind of control between
  them. It used to turn off every radio button in its container.

Docs: docs/mcp.md now says that notify runs the handlers without closing
the dialog.
2026-11-23 12:25:38 -08:00
dotCooCoo 29153af625 Scripts: ScriptUI controls take size objects, event listeners, list find and remove, and Window.alert
- Every element starts with preferredSize, size, minimumSize and
  maximumSize objects whose width and height are -1, so a script can
  set one side, as in preferredSize.width = 100. A positive side of
  size takes the place of preferredSize's, and the layout keeps a
  control within its minimum and maximum.
- Controls and the dialog take addEventListener and
  removeEventListener for click, change, changing and show. Handlers
  run in the capture phase on the containers, on the control after its
  onClick, onChange or onChanging, then on the containers again until
  one calls stopPropagation(). A button with a click listener no longer
  closes the dialog by itself.
- Window.alert, Window.confirm and Window.prompt open the same dialogs
  as alert, confirm and prompt.
- A list has find(text) and remove(what), and takes its items in
  properties.items; a container has remove(what).
- A group takes its creation properties as the third argument of add(),
  and orientation, alignChildren, spacing, margins and alignment given
  there are its first values.
- Setting a radio button's value to true turns off the radio buttons
  added next to it in its container, and notify("onClick") turns a
  radio button on and a check box over before onClick runs.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 11:35:40 -08:00