Keep XMP file buffers in native state and release them at the file run boundary. Count registered namespaces and expanded metadata against the heap limit. Reset marked readers after updates and allow failed library setup to retry.
app.executeMenuCommand('Fit Artboard to artwork bounds') threw the
command's error when the active artboard was locked or had no art on
it. The canvas's right-click menu dims Fit to Artwork Bounds then
(DocState::any_art_to_fit), so the script now does nothing and adds
no undo step, as for the other menu items that are not available. The docs state
that an available menu item runs its command and that an error that
command returns throws.
The host-versus-checker name table lists
Application.prototype.executeMenuCommand.
The script host ran its realm with E4X off, so XML literals were syntax
errors and XML, XMLList, Namespace, QName, isXMLName and
setDefaultXMLNamespace were missing from every script, although
vectorcraft-js has them. script.run and File › Scripts now turn E4X on
for .js and .jsx files, script text, #include files, $.evalFile, eval
and Function, and for a #targetengine engine.
script.check lists the e4x and xml features under the language need
instead of hostOnly, since VectorCraft runs them.
New Document's More Settings now shows the columns a preset's rows give
the current artboards, and a new layout or column count replaces those
rows, in the dialog main rewrote.
- Assigning hidden, locked, position, left, top, width or height to an
object in a hidden or locked layer throws Cannot edit, as opacity
does, and changes nothing. Its name and note still change.
- An object with nothing in it, such as an empty group or a compound
path whose paths moved out, reads its bounds, position, width and
height as zeros, and assigning them does nothing, so reading every
property for-in lists does not throw on it.
- Assigning selection without app. sets the active document's
selection, and app.selection can be assigned the same way. Assigning
activeDocument without app. activates a document, and assigning
documents keeps its value.
- JSON.stringify writes a collection, or data that holds one, without
reading toJSON through the collection's name lookup, which threw
Not found.
- The docs state that Object.keys, Object.getOwnPropertyNames and
Object.getOwnPropertyDescriptor do not report the members, that a
value assigned to a member the class lacks is not kept, and that the
selection order is VectorCraft's own rule.
Docs: docs/mcp.md, docs/target-app-parity.md.
Scripts that check a member with hasOwnProperty before using it skipped
every page item, because the members live on the class prototype. Now
hasOwnProperty and propertyIsEnumerable are true for each member of an
object's class that is available, and for-in lists its properties but
not its methods. Members that only throw "not available yet" stay false.
- An empty selection is an empty list instead of null.
- pageItems lists art topmost first, as the CMYKColor example reads the
frontmost path as pathItems[0]
(https://ai-scripting.docsforadobe.dev/jsobjref/CMYKColor/). A
document's selection lists the selected objects in that order too,
whatever order they were picked in. That selection order is
VectorCraft's own rule.
- A collection read with a name, such as pageItems["Logo"], gives what
getByName gives, as
https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/
shows. A name nothing has throws Not found, and assigning to such a
name throws the same error.
- activeDocument, documents and selection can be named without app., as
that page describes for the application's members.
- move() with the object itself and PLACEBEFORE or PLACEAFTER leaves it
where it is and adds no undo step.
- move() keeps a compound path whose last path moves out, so a script
that holds it can still read it.
- Assigning opacity to an object in a hidden or locked layer throws
Cannot edit and changes nothing.
- name takes a number or a Boolean as its text.
- String() of an object gives its class and name, such as
[PathItem Logo].
Docs: docs/mcp.md, docs/target-app-parity.md.
- 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.
script_host_vs_scriptcheck failed on this branch because the host now adds the global
ExternalObject. It goes in the table of names that reach outside the document, with the
nativeCode id that script.check gives it; its length, prototype, search, constructor and
terminate members stay inside.
A script can now build a modal dialog with new Window("dialog", title)
and add() groups, panels, static text, edit fields, buttons, check
boxes, radio buttons, drop-down lists, list boxes, sliders and progress
bars. The engine checks the description and lays it out without
recursion, within VectorCraft's own limits (512 controls 16 deep, 1024
list items, 16 KiB a text, sizes clamped to 8192 px). Other control
types, palettes and resource strings throw that they are not available
yet.
- show() waits like alert, runs onClick, onChanging, onChange, onShow
and onClose in the run's fuel, and returns close(result)'s result, 1
for the default button or 2 for the cancel button, or 0 for the close
box. A show() inside a handler throws.
- In the app the dialog draws the controls where the engine placed
them, gives text still typed in a field before a click or a close,
and keeps its state while a handler runs. Enter clicks the default
button, Escape the cancel button, and Stop ends the run and puts the
documents back.
- A run over MCP or the command line takes a window answer: the steps
of one show(), each a click, a change or a close.
- The report lists each dialog with its controls, events and result;
vc.api.has("scriptui") is true.
Docs: docs/mcp.md (script.run), docs/target-app-parity.md.
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.
Every object now has a read-only reflect property. Each read gives a new
frozen reflection with the class name, the properties and methods as
entries (name, type, dataType, defaultValue, min, max, isCollection,
arguments), and find(name).
- app, its documents, page items, layers, DocumentPreset and each class
constructor are described from the host class registry: the installed
members give the names and access, and the new HostClass.info gives the
types, bounds, defaults and method arguments dom.rs declares beside
each member. Members that are not available yet are left out. A class
that names a member twice or describes a member it does not have is
refused.
- Any other object is described by its own properties without running a
getter; a JavaScript function's parameters are its arguments.
- An object with more than 10,000 members and arguments throws a
RangeError.
- script.check counts reflection as a language feature, not host-only.
Docs: docs/mcp.md, docs/target-app-parity.md.
- new DocumentPreset() now makes an object of the DocumentPreset class whose settings the run
keeps, so addDocument refuses a plain object, one with a typename of DocumentPreset included,
with a TypeError naming presetSettings.
- When file.new reports a profileError, addDocument throws an error that names the profile and
the reason, and the document made with the defaults is put back.
- A script's file.new reads the New Document profile file in the app's own profiles folder;
the automation roots in force still apply. Before, the script's file gate refused the folder,
so a scripted addDocument never used an edited profile.
Docs: docs/mcp.md.
PageItem.tags and Document.tags give scripts the Tags and Tag objects
the scripting reference describes: name and value pairs on a page item,
read, added, renamed and deleted through the new object.tags,
object.tag.add, object.tag.set, object.tag.remove and
object.tag.removeAll commands, each one undo step. The native file keeps
the tags and their ids. On opening, each object keeps its first 64 tags
whose name and value are at most 65,536 bytes, and a tag whose id is
missing, out of range or repeated gets a new one. A deleted tag's id is
not given out again, so a script's Tag for it throws "Stale tag".
The undo history's memory estimate now counts the text an object's
attributes hold (note, URL, data, events, classes, foreign attributes
and tags).
The host name test now has rows for app, the document model classes and the enumerations the script host adds. zOrder on a path inside a compound path throws an error and leaves the document unchanged, as duplicate does.
- variable.setBinding refuses an embedded image only for an image variable,
so a script can bind an embedded image's visibility.
- A Dataset object stays usable after dataset.import, variable.loadLibrary
or variable.import leaves the document's data sets as they were, or the
import is put back; it goes stale only when the data sets change.
- script.check reports a document's exportVariables as filesWritten and
file.write, and the script host test lists the variable and data set
names the host adds.
Docs: docs/mcp.md.
docs/target-app-parity.md gets a line for the file.write report on a
File object's length, hidden and readonly and for the test that lists
every name the script host adds, with the tests that cover them. The
test's comment on vc no longer names another app.
Setting a File object's length truncates or pads the file, and setting
readonly or hidden changes it, but script.check reported no outside
category for those assignments. It now reports file.write and
filesWritten for them: plain and compound assignment, ++ and -- before
or after, and the property name as a string literal in brackets.
A new integration test lists every global and member the script host
adds to the JavaScript engine (the own properties of the global object,
of each object or function it holds and of each function's prototype,
compared with a plain engine) and fails when one has no row. Each name
that reaches outside the document has a probe script, and the test
checks that script.check gives it the expected outside id. vc is listed
as not checked: script.check reads scripts written for the reference
app's scripting, and what vc.run does depends on the command. The test
also checks that the checker lists every preprocessor directive the
host reads, through the new DirectiveName::ALL.
File object properties:
https://extendscript.docsforadobe.dev/file-system-access/file-object/