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.
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.
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.
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}.
`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.
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.
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.
`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.
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.
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.
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.
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.
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.
docs/mcp.md's line and stack row said $.stack shows at most 64 lines
and uses [global] only for the script's own code. It keeps the
innermost 64 frames after a leading line "…" when some are left out,
and [global] names any code outside a function, including code that
an included file, $.evalFile or eval runs. The row now also says how
a frame's file compares with $.fileName in each case: the same file
for code from a file, the run's name where $.fileName is empty for a
script given as source, [eval] where $.fileName is the file being run,
and [unknown] at line 0 where $.fileName is empty.
The engineName row now gives the #targetengine name, and the
script.run params text, the script module doc and the Scripts evidence
line say $.fileName is the file of the code that reads it rather than
the file being run.
copy read the source's real path as it was when looked up, so a file replaced by a link before the read could copy a file from outside the script's places, and a link given as the source that was pointed elsewhere copied the old target. copy now reads the path as given through the same checks open uses and refuses the copy with Script file access denied when the path no longer leads to the file it was looked up as.
rename named only the new path in written, so a run that renamed a file an earlier run wrote did not name the path it emptied. It now names both, as remove names the path it deletes.
- A command a script runs reads only where the script may, also in a run the person started; only
reads of the app's own folders inside the command are exempt.
- Always and script.grants.revoke leave a grants file they cannot read as it is, and fail.
- script.grants names a path outside the automation read roots by its file name alone.
- copy reads the source once, within the 8 MiB limit, writes those bytes, and gives the copy the
source's permissions.
- write joins its values as UTF-16 before making them text, so a surrogate pair split between two
values is one character.
A script run from a file directly in the settings folder could read every
file in that folder, Script Grants.json included, because its own folder
was left open inside the fence. Only folders below the settings folder
stay open now, and a script in the settings folder itself reads only its
own file there.
The profiles Edit > Assign Profile gives a document stayed the active
color settings after another document came to the front, so a new,
opened or switched-to document drew and converted its colors through the
previous document's profile, and closing the last document left it in
use.
The session now puts the front document's profiles in use (the working
spaces where it has none, or no document is open) after a new or opened
document, a tab switch, a close, File > Revert, every command including
each batch step and Undo or Redo of Assign Profile, a failed batch or
plug-in call, a script's rollback and slice boundaries, a canceled
preview, undo group or undo scope, and for each document Export All Open
and the update of placed documents work in. The active settings are
rebuilt, and the documents redrawn, only when they change.
$.line and $.stack counted lines in the run's expanded source. In code
that comes after an #include they gave lines that match no file, and
this included code in a file $.evalFile ran and code a named engine
kept from an earlier run.
Both now map each frame through the run's source maps, as uncaught
errors already were. $.stack writes each frame as name@file:line,
outermost first, with the run's name as the file of a script given as
source. Code that eval or Function compiled keeps the line of the
source they compiled, in [eval]; code whose place a named engine no
longer keeps is at line 0 of [unknown]. The 64-frame limit, [global]
and [anonymous] are unchanged.
Docs: docs/mcp.md, docs/target-app-parity.md.
$.fileName gave the file being run, so a function defined in a file
that #include inserted, in a file $.evalFile ran, or in an earlier run
of a named engine reported the calling file instead of its own.
- vectorcraft_js: HostItem::SiteGetter gives a getter the CallSite
(source tag, line, column) of the code that reads it.
- $.fileName maps that place through the run's source maps, or the
maps a named engine kept, to the file the code is in. It is empty in
code from a script given as source and in kept code whose map was
dropped. Code that eval or Function compiled still gets the file
being run.
Docs: docs/mcp.md, docs/target-app-parity.md.
A script's File and Folder objects now open files for writing, appending
and editing, and copy, rename, remove and create files and folders. A
script reads and writes its run's temporary folder (Folder.temp) and its
own data folder (Folder.userData), kept between runs for a script run
from a file and inside Folder.temp for a script given as text. It reads
its own folder, and reaches other places only through File.openDialog,
File.saveDialog, Folder.selectDialog and the objects' openDlg, saveDlg and
selectDlg.
- A file dialog asks first. The person picks the file or folder with
Choose..., then allows it once or, for a script run from a file, always.
A kept grant is bound to the script's path, the SHA-256 of its text and
every source the run evaluated. It is withdrawn when a later run of the
script evaluates other code, including code an earlier run left in the
same named engine. It stays on the real path that was granted, so a
link put in that place later does not carry it elsewhere.
- A dialog's filter is a string of file types or a function that is
called with each file picked; multiSelect gives an array of the files
picked, at most 2,048, and the dialog says when more were left out.
- A folder's selectDlg opens the host's folder dialog in that folder,
also where the host shows file dialogs in line. Enter in the file
dialog denies, unless it goes to the focused Choose... button.
script.grants.revoke is refused with the busy error while a script
runs, as the run keeps the grants it started with.
- The paths a file dialog allows come only from the host's file dialog:
ui.dialog.set cannot set them. Only the person at the keyboard allows
access; Allow Once and Always Allow sent by automation are refused. The
dialog describes the access the run asked for, whatever its fields say.
- No grant reaches the settings folder, also when the script's own folder
holds it.
- A file left open is not written through a link put in place of its
folder since it was opened, and Folder.userData is null when the data
folder or the script's folder in it is a link.
- copy onto another link to the same file (a hard link) leaves the file's
bytes as they are, after the source's open objects have written what
they hold. Files are compared by identity (device and inode on Unix,
volume and file index on Windows).
- Folder.temp and Folder.userData check each folder they make against the
automation write roots first, and Folder.create() makes nothing when a
missing folder above the target is outside the places the script may
write.
- An open file holds at most 8 MiB, a run writes at most 32 MiB and keeps
at most 256 files open, and the files a run left open are written in
the order they were opened. Setting length and copying a file count the
bytes every open object of that file takes, and write checks the joined
text against the limit while joining it. The report names at most 4,096
written files and sets writtenMore when there were more.
- Errors a script sees are translated in every complete message catalog.
The status bar shows a failed script run as one line: the script's
name, the line and column (and the included file), the error and the
kind of failure, with any files the run left written. No catalog had a
row for that line, so the whole line stayed in English. The errors of
File, Folder, vc.run, $.evalFile, a script's $ object, its alert,
confirm and prompt dialogs, vc.document, vc.log, the limits a run can
pass and Drop Script Engine had no row in any complete catalog either,
and several were not listed by the untranslated-strings report.
- Every complete-message catalog has rows for these errors and for the
failed-run line at each place and for each kind (syntax, thrown,
limit, stopped, internal). The script's name, paths, numbers, code
names ($.flags, File, answers, true, null, UTF-8), command ids and
the text a script throws itself are kept.
- A failure with no line and column, such as an error in code eval
compiled, is shown with one colon after the script's name
("t.js: TypeError: no (thrown)" instead of "t.js:: TypeError: no
(thrown)").
- A placeholder that occurs twice in a message template matches only
the same text both times. Before, "{name}: the next answer in
`answers` is for {_1}, not {name}" matched a whole failed-run line
and dropped its line, column and kind.
- The message scan reads the script host's fail(, value( and .over(
helpers and the script interpreter's errors (the js crate), skips
*_tests.rs files and cfg(all(test, ...)) modules, and reads a
constant's text from the file or crate that declares it, so the
Scripts menu's headers are no longer listed as messages.
Tests: i18n::tests::script_errors_are_translated,
script_host_errors_are_translated,
a_repeated_placeholder_matches_the_same_text,
message_scan_reads_constants_of_the_file_and_its_crate,
message_scan_reads_script_interpreter_errors,
message_scan_skips_test_modules_with_any_test_cfg,
tests::script_run::an_error_without_a_place_names_the_script_and_kind.
A client confined by --automation-read-root saw paths outside its read
roots that the person or an earlier request had put in the session:
- plugin.list: the plug-in folder last loaded and its failed files;
plugin.list and plugin.info: a plug-in's source file; plugin.list,
plugin.safeMode and plugin.setEnabled: the file of a plug-in turned
off for the next launch.
- file.recovery.list and file.recovery.restore: a document's original
file; file.recovery.list and file.recovery.save: the recovery folder.
- ui.inspect's scriptReport: the files a run wrote and the included
file a failed run stopped in.
A folder outside the read roots is now null, and a file outside them is
named by its file name. plugin.setEnabled {file} takes that name. The
restored documents keep their files, and unconfined clients and the
app's own UI see the same replies as before.
A run whose script fails to compile defines no code, so its source map
is not kept and the places of earlier runs stay within the engine's
budget. docs/mcp.md and the progress line say so, and the progress line
names the errors that are reported without a line and column.
A function an earlier run of a named engine defined was reported without
a line, column or file when it threw in a later run. The realm now gives
each source a tag that stays the same from run to run (Realm::error_tag,
Realm::script_tag), and no two sources share one once the tags run out.
Each named engine keeps the source maps of its runs' scripts, included
files and $.evalFile files, within 8 MiB, dropping the oldest first, and
an error in kept code is reported at that file, line and column. The
report's name and the console line keep the calling run's name. For an
earlier script given as source, file is that run's name.
Docs: docs/mcp.md (Script engines), script.run params text,
docs/target-app-parity.md.
script_pump read vectorcraft_doc::cancel only after the guard that keeps
a run waiting, so a run asleep in $.sleep went on waiting until its wake
time (up to 1,000 ms), and a run waiting at a dialog or for approval to
grow waited until someone answered. The check now runs before that
guard, after the dialog-failure check, so a canceled request ends the
run at the next slice and every document goes back.
- `File.encode` and `Folder.encode` leave `/` unescaped, as the File
object reference lists it among the characters kept
(https://extendscript.docsforadobe.dev/file-system-access/file-object/).
- `exists` is true for a `File` only when the path names something
other than a folder, and for a `Folder` only when it names a folder.
- Fields of the records the app returns are read as own properties, so
a property a script puts on `Object.prototype` does not turn a
successful `open` into a failure.
- `File.encode`, `File.decode`, `File.isEncodingAvailable` and the
`Folder` locations count as file calls and charge the host-call limit.
- On the web the locations are `null` and `File.tempName` names a file
at the root, without asking the platform for a temporary folder.
A script whose first lines name an engine with `#targetengine name` (or
`//@targetengine name`) runs in that engine, and a later script that names
it sees the globals and functions earlier runs left, until the engine is
dropped or the session ends. A script without the line, and
`#targetengine main`, still get a new engine for each run.
- A session keeps at most 8 named engines, each with a 64 MiB heap. A run
that goes past the heap ends with the heap limit, and the engine stays
usable. Names are 1 to 64 bytes. The line comes once, in the script
itself, before its code and its #include lines.
- An uncaught error, a limit or script.stop puts the documents back and
keeps the globals the run set. An internal error drops the engine. A run
stopped at a dialog or left paused ends where it was before the engine
is kept. An error in a function an earlier run defined is reported
without a line and column.
- `vc`, `$`, `alert`, `confirm` and `prompt` are made once for each engine
and act for the run that calls them, including copies an earlier run kept
in a global. `vc.args` gives a read-only copy of the calling run's
`args`, and what a run sets on `$` lasts for that run only.
- `script.engines` lists the named engines with their heap, and
`script.engine.drop {name}` drops one. Scripts cannot run either.
- The engines stay on the thread that made them. A session used on
another thread starts there with no named engines, and the old ones are
dropped on their own thread.
- The web build has no named engines: a run that names one other than
`main` ends with an error before any of it runs.
- `Realm::end` ends a run where it is, `Realm::error_source` counts from
the realm's last script, and `HostItem::FrozenGetter` gives a frozen
value each time it is read.
- The script checker lists `#targetengine` as a supported directive.
Docs: docs/mcp.md, docs/target-app-parity.md, docs/gaps.md.
Scripts get the File and Folder classes as built-ins of the script
engine. A script run from a file can test whether files exist, read
their properties, list folders with getFiles (a mask or a function),
and open files to read them with read, readln, readch, seek and tell.
- Reads stay inside the script's folder and, when automation read
roots are set, inside them too. A script given as text reads no
files. Network and device paths, and paths outside the folder by
their names, are refused before anything is looked up. Links and
junctions that lead out are refused, and getFiles leaves them out.
- The encoding comes from the byte order mark, then the encoding the
script set, then UTF-8 when the bytes are valid, then CP1252.
- Limits: 8 MiB a file, 32 MiB a run, 256 files open at once, 2,048
getFiles entries and 65,536 names looked at, and paths of at most
32,767 characters.
- Writing, the file dialogs and execute are not available yet: they
return false or null and set error.
The report's hostCallCounts gains fileCalls and fileExecutes.
Docs: docs/mcp.md, docs/target-app-parity.md.