New Document moved to the craft UI framework on main. More Settings'
Columns now shows the columns a preset's rows give the current number
of artboards, a new column count replaces those rows, and a new layout
keeps the columns they showed.
Layer.pathItems and GroupItem.pathItems now return a PathItems collection
for the paths directly in the layer or group, topmost first, as the Layer
and GroupItem pages describe them
(https://ai-scripting.docsforadobe.dev/jsobjref/Layer/,
https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/). Before, both
threw an error that said they were not available yet.
- The collection has the members of Document.pathItems. Its parent is the
layer or group, and length, [i], index and getByName read only that
container's paths, so a path inside a group, a compound path or a
sublayer is not listed.
- add() and the shape creators put the new path on top of the layer's or
group's contents and leave the current layer as it was. The path is
made with the container's layer current (layer.setCurrent) and, for a
group, moved into it with node.move, in the run's one undo step.
- VectorCraft's own rule: a layer or group that is hidden or locked, or
that is in a hidden or locked layer or group, throws "Cannot add a path
to a hidden or locked layer or group" and no path is made.
- The last four path lists stay cached while their documents are
unchanged, so a loop over a large layer or group builds its list once.
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.
A document now has layers, activeLayer, groupItems, compoundPathItems and
artboards, and every page item has its layer.
- Layers and sublayers: add, remove, removeAll, getByName, index, name,
visibility, lock, print, preview, dim images, opacity, color, stacking,
move and zOrder, each through the existing layer and node commands.
- Groups: clipped makes or releases the clipping mask, and
groupItems.add() makes an empty group through the new narrow command
object.newGroup. A document's groupItems and compoundPathItems hold
every group or compound path at any depth; a layer's or group's hold
only the ones directly in it.
- Artboards: add, insert, remove, getByName, rectangles, names, ruler
origin, pixel aspect ratio and display options, and the active
artboard. A new artboard gets an "Artboard N" name no other artboard
has. setActiveArtboardIndex adds no undo step; script.run's report
lists the change in activeArtboards and the app shows it.
- Bad values throw before any command runs, and a value a layer or
artboard already has runs no command. Handles to a deleted layer or
artboard throw Stale layer or Stale artboard.
Docs: docs/mcp.md, docs/gaps.md, docs/target-app-parity.md.
Document.pathItems lists a document's paths and makes empty paths,
rectangles, rounded rectangles, ellipses, polygons and stars with the
parameter order and defaults of the PathItems help page. A PathItem
reads and changes its points, closed state, fill rule, area, length,
fill and stroke colors, stroke options and overprint, and translates,
rotates and resizes. PathPoints and PathPoint read and set each
point's anchor, handles and type. RGBColor, CMYKColor, GrayColor,
LabColor and NoColor make colors; a gradient, spot or pattern paint
reads as GradientColor, SpotColor or PatternColor.
Each change runs an existing command (path.create, the shape.*
commands, path.setAnchors, path.close, path.setFillRule,
paint.setFill, paint.setStroke, stroke.set, object.setOverprint,
object.move, object.rotate, object.scale) inside the run's one undo
step, and puts back the selection and the paint for new art. A value
that changes nothing runs no command; a bad value throws and changes
nothing.
path.setAnchors now makes an anchor a corner when it is given
`smooth: false`; before, the key was ignored and handles in line made
it smooth.
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/