Commit Graph
109 Commits
Author SHA1 Message Date
dotCooCoo 1ac56ef3ba Scripts: script.grants reports a grants file that is a link to a missing file
A link in the grants file's place whose target is missing is there but
cannot be read, so script.grants fails on it and script.grants.revoke
leaves it as it is, instead of treating it as a missing grants file.
2026-11-24 17:54:20 -08:00
dotCooCoo 6d0d4bd1a4 Merge main into fix/script-grants-read-failure 2026-11-24 17:26:58 -08:00
BFlat cf2c4ae3f7 Merge pull request #9187 from dotCooCoo/fix/js-dollar-stack-script-frame
Scripts: $.stack starts with a line that names the running script
2026-11-24 16:08:08 +07:00
BFlat 7696b503e6 Merge pull request #9079 from dotCooCoo/feat/js-es2015-block-arrow-template
Scripts: .js scripts run let, const, arrows, templates, default and rest parameters and spread
2026-11-24 16:06:07 +07:00
BFlat c79555c25c Merge pull request #9070 from dotCooCoo/feat/scripts-unitvalue
Scripts: UnitValue measurements convert and calculate with their units
2026-11-24 16:05:51 +07:00
dotCooCoo f205705617 Scripts: $.stack starts with a line that names the running script
$.stack is the current stack trace
(https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/).
It now starts with a line holding the run's name in square brackets, such
as `[main.jsx]`, the name the console shows for the run: the `name` given
to `script.run`, else the `#script` name, else the file's name, else
`script`. The frames follow as before. Scripts that look for a bracketed
line in the trace to find their own name, for example to name a
preferences file, now find it.

The name line comes before the `…` line that stands for frames past 64.
A realm without a name (`Realm::set_script_name(None)`) writes no such
line.

Docs: docs/mcp.md ($ object table), docs/target-app-parity.md.
2026-11-23 11:17:06 -08:00
dotCooCoo af91c28c64 Merge main into feat/scripts-unitvalue 2026-11-22 00:30:37 -08:00
dotCooCoo 8d0001308f Merge main into feat/js-es2015-block-arrow-template 2026-11-21 22:52:36 -08:00
dotCooCoo dc9a724b6a Merge main into fix/script-export-linked-files 2026-11-21 21:04:37 -08:00
dotCooCoo 7d3094afe6 Scripts: .js scripts run let, const, arrows, templates, default and rest parameters and spread
vectorcraft-js gains Options::es2015, which reads and runs these
ECMAScript 2015 forms: let and const with block scope and their
temporal dead zone, a new let binding for each loop iteration,
function declarations scoped to their block (with the Annex B.3.3
variable outside strict mode code), arrow functions, template
literals and tagged templates, default and rest parameters, and
spread in array literals, calls and new. Spread reads arrays,
strings by code point and objects with a length, by index, and
throws a TypeError for anything else until iterators are added.

Eval code outside strict mode code cannot declare a var that clashes
with a let or const around it, or with a parameter inside a default
value. Spread, template objects and the new scopes take fuel and
count against the heap limit, and nested arrows and templates count
against the depth limit.

script.run sets the option for a .js file; eval, Function, #include
files, $.evalFile and a kept #targetengine read code the way the
running script does. A .jsx file and a source string stay ES5.1.

The test262 runner gains an ES2015 subset run, read without and with
the option. docs/mcp.md and docs/target-app-parity.md describe the
new forms.
2026-11-21 20:43:20 -08:00
dotCooCoo ceab5d7e11 Merge main into fix/script-grants-read-failure 2026-11-21 20:33:50 -08:00
dotCooCoo 1ab09c8978 Scripts: UnitValue measurements convert and calculate with their units
Scripts get the global UnitValue constructor: a number with one of the
length units (inches, feet, yards, miles, millimeters, centimeters,
meters, kilometers, points, picas, traditional points and picas,
ciceros), pixels or percent. as() and convert() give or change the
unit, baseUnit sets what one pixel and 100% measure, and the arithmetic,
comparison and unary operators calculate with the object's number. With
two objects the right one is converted to the left one's unit.

Conversions go through exact ratios to the inch, so 1 in is exactly
72 pt. An unknown unit or text makes an invalid object; converting it or
using it with an operator, a result that is not finite and a comparison
with a number that is not finite throw a RangeError.

A realm without UnitValue keeps the standard operators. docs/mcp.md
describes the class.
2026-11-21 19:56:57 -08:00
dotCooCoo 29ddc57821 Scripts: what a script's commands open or change gives later runs no file access
The commands a script runs could read the files that the documents open
at the run's start link to, and could read and write the files of every
open document. Both lists were taken from the documents as they were, so
a document a script opened, or a link or data set value a script added,
widened what the next run could read, and a document opened from a
linked file could be saved over that file in the next run.

- DocState::by_script records what scripts' commands did to a document
  since the person last opened or saved it: opened it, or changed it or
  gave it another file, keeping the document, its file and the file it
  was read from as they were before. The script host notes it after
  every command, and a save the person makes from the document's current
  content clears it. Revert keeps it, and a recovery copy restores the
  document as one a script opened.
- The gate's document files and the linked files are taken from each
  document as the person left it (DocState::as_person_left). A document
  a script opened gives neither, in that run or a later one.
- This replaces the per-run record of paths read through the linked
  files and ScriptGate::keeping_linked_read_only.
- docs/mcp.md and docs/target-app-parity.md describe the rule.
2026-11-21 02:45:27 -08:00
dotCooCoo bab25d0248 Scripts: a document opened from a linked file stays read-only when its path changes
The gate now records each path a script's command reads only because it led
to a file the open documents link to. A document whose file is such a path is
taken out of the open documents' files for the rest of the run, without
looking at where the path leads now or what the script may read now. Before,
the gate decided that again for each command from the path's current target,
so a path pointed at another file by a link, or a read grant given later,
let the run read and write through the document.
2026-11-21 01:32:08 -08:00
dotCooCoo 9758ece7ef Scripts: vc.run export of an open document reads its own linked files
A command a script runs with vc.run could read only the script's own places
and the open documents' own files, so an export, save, print or package of
a document whose linked images or placed files sit elsewhere fell back to
the saved previews.

The script gate now also reads, and never writes, the files that the
documents open when the run began link to: linked images, placed files, the
plate files of a DCS image and the images their data sets name. The list is
taken once, at the run's first vc.run, from those documents as they were
when the run began, and holds real paths, so a path that leads to another
file later is refused. A link the script adds or re-points, a path it names
itself and a document it opens give it no further file to read, a document
it opens from one of these files is not saved over it, and the automation
read roots and the name and traversal rules still apply first.
2026-11-21 00:07:34 -08:00
dotCooCoo 999521e391 Scripts: File.hidden can be set and File.createAlias makes a link within the grants
On macOS and Linux, setting `hidden` renames the file or link in its folder with
one leading dot added, or its leading dots taken off. Both the old and the new
name must be places the script may write, and a name of dots alone, a name in
use and a folder are refused. A file the object has open stays open at the new
path.

`createAlias(target)` makes a symbolic link at the object's path to the real
path of a file the script may read. The link's place must be one the script may
write where nothing is, a link that leads nowhere included; the settings folder
is refused for both. When a folder above the link's place is replaced by a link
while the alias is made, the new link is removed and the call fails. `hidden`
reads a link's own name, and setting `hidden`, `rename` and `remove` act on the
link itself.

On Windows both still set `error` and change nothing. `execute` stays
unavailable.

Behavior: https://extendscript.docsforadobe.dev/file-system-access/file-object/
and https://extendscript.docsforadobe.dev/file-system-access/using-file-and-folder-objects/
2026-11-20 21:38:37 -08:00
dotCooCoo 153f6c0750 Scripts: script.grants reports an error when the grants file cannot be read
script.grants listed no grants when Script Grants.json was there but
could not be read, was larger than 4 MiB, did not parse, had another
version or held no list of grants, or when its lock could not be taken.
It now returns "the script file permissions could not be read: {e}" in
those cases, as script.grants.revoke already fails on such a file. A
missing grants file still lists none, and a grant in the file that is
not well formed is still left out.

The run-time grant lookup keeps reading such a file as holding no grants.
The new message has a row in every complete-message catalog. The params
text, docs/mcp.md and the Scripts line in docs/target-app-parity.md state
the error.
2026-11-20 20:23:01 -08:00
dotCooCoo 5d8609e881 Merge main into feat/proof-setup-save-load
# Conflicts:
#	crates/ui-egui/src/dialogs.rs
#	crates/ui-egui/src/i18n/tests.rs
2026-11-19 04:47:38 -08:00
dotCooCoo 2eeb582f35 Merge main into feat/proof-setup-save-load 2026-11-18 17:16:14 -08:00
dotCooCoo 6c5e10fd64 Color Settings: keep script gates and background reads after a profile answer
- A scope narrowed to the confirming caller keeps the script gates of both,
  and reads are exempt from them only where both scopes exempt them.
- A file read off the UI thread does the rest of its read after its profile
  answer (linked files and type) off the UI thread too; an open a caller
  asked for by path still finishes before OK returns.
2026-11-18 16:46:24 -08:00
bflatastic a08ffe592c script: the unwritten-files error says it isn't the script's own
Two merges crossed: one added RunError::authored, the other built a RunError for files a run
couldn't write without it, so main stopped compiling.
2026-11-19 00:53:32 +07:00
BFlat 48c8ae52a9 Merge pull request #7802 from dotCooCoo/fix/text-a-script-throws-itself-is-not-translated
Scripts: the status bar shows text a script throws as it is
2026-11-19 00:39:21 +07:00
dotCooCoo d42995dcff Merge main into feat/proof-setup-save-load 2026-11-17 20:26:07 -08:00
dotCooCoo af09fc2064 Scripts: open files are written in the order they were opened
When two File objects held changes to the same file, copy, length, a
new open of the file and a withdrawn grant wrote them in no fixed
order, so the copy or the file could end up with the older object's
bytes. They now write them in the order the objects were opened, as
the end of the run does.
2026-11-17 07:14:42 -08:00
dotCooCoo 3c73995861 Merge main into feat/script-file-folder-write 2026-11-15 16:06:24 -08:00
dotCooCoo 5805bbdd5a Merge main into fix/text-a-script-throws-itself-is-not-translated 2026-11-15 16:06:11 -08:00
dotCooCoo d6e96a0b09 Merge feat/proof-setup-customize into feat/proof-setup-save-load 2026-11-15 13:09:29 -08:00
dotCooCoo 23be2d879f View: Proof Setup saves and loads a custom proof setup
The Proof Setup dialog gets Save… and Load… buttons. Save… writes the
dialog's settings to a proof setup file, and Load… reads one back into
the dialog. View › Proof Setup lists the setups in the Proof Setups
folder next to the preferences below Customize…, and choosing one makes
it the proof setup with Proof Colors on.

view.proofSetup.save, view.proofSetup.load, view.proofSetup.read and
view.proofSetup.list do the same from scripts and control clients. The
file is VectorCraft's own JSON format (.vcproof, at most 64 KiB).
2026-11-15 13:09:24 -08:00
dotCooCoo dc2ae3dbc2 Merge main into feat/script-file-folder-write 2026-11-14 22:56:25 -08:00
dotCooCoo b368621c01 Merge main into fix/text-a-script-throws-itself-is-not-translated 2026-11-14 22:44:11 -08:00
dotCooCoo 34be6ee324 Merge main into fix/the-liquify-warning-s-tool-name-and-object-kinds 2026-11-14 21:54:06 -08:00
BFlat b4bd916141 Merge pull request #7737 from dotCooCoo/feat/select-similar-button
Control bar: Select Similar Objects selects by the attribute its menu keeps
2026-11-15 12:37:57 +07:00
dotCooCoo 5dc2126c45 Merge main into fix/text-a-script-throws-itself-is-not-translated 2026-11-14 21:10:12 -08:00
dotCooCoo fa53bc2940 Merge main into fix/the-liquify-warning-s-tool-name-and-object-kinds 2026-11-14 20:48:34 -08:00
dotCooCoo 24f7303c08 Merge main into feat/script-file-folder-write 2026-11-14 20:47:33 -08:00
dotCooCoo 16d1ed57ac Scripts: the status bar shows text a script throws as it is
A failed run's status translated a script's own thrown text whenever it
matched one of the app's messages, so `throw new Error('invalid array
length')` read as the app's translated error. Run errors now say whether
their message is the script's own text: errors the interpreter or a host
function throws are marked when they are made, stay the app's own when a
script catches and rethrows them unchanged, and become the script's text
when it changes their name or message. The status bar translates the
words around such a message and shows the script's text unchanged.

- `script.run`'s failed report adds `messageOrigin` (`script` or
  `built-in`); `message`, `kind` and the console line are unchanged.
- The advice about other applications' objects follows only the app's
  own reference errors, not the same text thrown by a script.
2026-11-14 20:42:01 -08:00
dotCooCoo f05d481247 Control bar: Select Similar Objects selects by the attribute its menu keeps
With something selected, the Control bar shows a Select Similar Objects
button and, beside it, the Select Similar Options menu. The button
selects the objects like the first selected one by the attribute kept
for the session; a menu item selects by its attribute and keeps it,
and the kept item is checked. The items are All, Fill Color, Fill &
Stroke, Stroke Color, Stroke Weight, Opacity, Blending Mode,
Appearance, Graphic Style, Shape and Symbol Instance.

- select.similar {by?} runs the select.same command of that name, or
  for "all" matches fill and stroke colors, stroke weight, opacity and
  blending mode together. An unknown by is an error that keeps the
  selection and the kept attribute. The journal records the attribute
  used, so a recorded action repeats it, and a failed script or plug-in
  call puts the kept attribute back.
- The button and menu belong to the Object Options group and sit at
  the right end of the bar, after the X, Y, W and H fields. They take
  only the room the other controls leave, so the bar leaves them out
  before any other control.
- The Paragraph tests' control_bar_node looks for a label before a
  value, so a link's text run listed first no longer stands in for
  the link.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-14 18:41:14 -08:00
dotCooCoo 8620f0611c Scripts: a file whose write fails after it was emptied is named as written
Writing an open file's bytes empties the file first. When the write then
failed, for example on a full disk, the file had lost its old bytes but
was left out of the files the run names as written. It is now named as
soon as it has been opened for the write.
2026-11-14 15:37:25 -08:00
dotCooCoo 828817c4b2 Scripts: File › Scripts runs the text its check read, with includes from the checked folder
The menu item checked a listed script and then ran script.run by its path,
which opened the file again; a link put in place of the file or a folder on
its path in between could make it run a file the check never saw, and the
include folder was looked up from the path again as well.

script.run takes installed: true. With a path it reads the file once through
script::folder::read, runs that text, and reads #include and $.evalFile in the
Scripts folder's real path followed by the names that read found. The menu
item runs script.run {path, installed: true}.
2026-11-14 15:37:18 -08:00
dotCooCoo b173bd7b40 Scripts: a folder renamed under another case of its name moves its open files
`rename` matched open File objects by the path as given, while the objects
hold the names the file system keeps. Where case does not matter, a folder
named in another case was renamed but its open files kept the old path, so
their changes could not be written and they stayed under the old path's
rules for reading. The objects are now matched by the kept name, and a
rename whose kept name cannot be learned is refused.
2026-11-14 15:00:12 -08:00
dotCooCoo 82620a1b27 Scripts: copy and length reach files open for reading
A file opened with open('r') kept its old bytes after copy wrote over it
or length changed it, while an object open for writing took the new
bytes. Both now update every object that holds the file. An object
that holds a renamed file is found at the new path, and an object whose
file was removed is not taken for a file made later at its path.
2026-11-14 13:19:25 -08:00
dotCooCoo 1ae70095cc Scripts: the grants-file lock waits a bounded time
Taking the lock on Script Grants.lock blocked until the holder let go,
so another process that stalled while holding it stopped listing,
loading, keeping and revoking grants for good. The lock is now tried 20
times, 50 ms apart, and then fails with TimedOut: a change is not made
and a read gives no grants rather than reading without the lock.
2026-11-14 13:06:54 -08:00
dotCooCoo d435ae1a27 Scripts: an open file that is renamed is read under its new path's rules
`rename` moved the write path of open File objects but left the path they
were read from at the old name. When new code then withdrew the kept grant
for the folder, a grant the run still held for the old path let the object
go on giving the file's bytes. The read path now moves with the write path.
2026-11-14 12:42:21 -08:00
dotCooCoo cefaeefca9 Scripts: grants kept earlier in a run keep the code evaluated before a later one
Keeping a second grant with Always marked all the code the run had
evaluated as recorded, so the run's end skipped the grants kept before
it, and they kept the code list from when they were kept. The next run
that evaluated that code withdrew them. Keeping a grant now writes the
current code list into the grants the run kept before it as well.
2026-11-14 12:38:25 -08:00
dotCooCoo 76ab8efad5 Merge main into fix/singular-messages-translated 2026-11-14 02:16:53 -08:00
dotCooCoo d621a077da Merge main into feat/script-file-folder-write 2026-11-14 02:16:44 -08:00
dotCooCoo df951caea4 Docs: $.fileName names the file being run in code eval or Function compiled
The script module docs, the script.run params text and the evidence line now
say that $.fileName in code that eval or Function compiled gives the file
being run, and the params text says that the empty name applies to code
compiled from a script given as text.
2026-11-13 21:09:02 -08:00
dotCooCoo 64662b435b Scripts: a file opened under a withdrawn grant is not read
When a run evaluated code that withdrew a kept grant, a File opened under that grant still gave the bytes it held to read, readln and readch, and seek to the end showed its length. Those calls now give Script file access denied and set error, and eof is true. docs/mcp.md says so.
2026-11-13 20:34:27 -08:00
dotCooCoo efd57a4a5d i18n: unused-answers and Liquify skip messages translate for one item too
The script error for answers left in `answers` and Liquify's warning about
objects under the brush that it left as they were built their singular by
adding an empty suffix, so no catalog template could match the singular
form, and neither message had a catalog row for either count.

- Both messages are now built from complete singular and plural English
  sentences; `it was` and `they were` are part of the sentence. The
  English the commands return does not change.
- Every complete-message catalog has an `@msgplural` row for each, with
  the language's own count forms. The tool name and the list of kinds
  stay as written.
2026-11-13 20:31:22 -08:00
dotCooCoo b73c9834c8 Scripts: grants file changes take turns and use a file of their own
Two processes that changed Script Grants.json at once both wrote Script Grants.json.part, so one could overwrite the other's file or fail on it. Each write now goes to a new file named for its process and write, passing over a name an earlier write left behind, and only that file is removed when the write fails. Changes hold a lock on Script Grants.lock beside the grants file and are not made when it cannot be taken; reads take it when they can.
2026-11-13 19:08:44 -08:00