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.
- 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.
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.
- 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.
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.
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/