Commit Graph
11 Commits
Author SHA1 Message Date
dotCooCoo 2356ffe747 Scripts: layers and groups give their own text frames
Layer.textFrames and GroupItem.textFrames threw "not available yet".
They now give a TextFrames collection with the members of the
document's: length, [i], index, getByName, add, pointText, areaText,
pathText and removeAll. It lists the type directly in the layer or
group, topmost first, as the layer's other collections do, and new type
goes on top of the layer's or group's contents whatever the current
layer. A hidden or locked layer or group throws and changes nothing.

text.create takes a parent: a shown, unlocked layer or group that the
new type goes on top of, whatever the drawing mode. Area type and type
on a path are moved there with node.move in the same step.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-24 17:55:12 -08:00
dotCooCoo d7dd4464d9 Merge feat/scripts-api-d4-text into feat/scripts-layer-text-frames 2026-11-24 16:47:49 -08:00
dotCooCoo c0d5fddc7c Scripts: the host's name table lists the text ranges' paragraph attributes and the add methods 2026-11-23 11:40:35 -08:00
dotCooCoo 8c2d2c0394 Merge feat/scripts-api-d1a-app-documents into feat/scripts-api-d4-text
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
2026-11-21 20:00:34 -08:00
dotCooCoo 9156d7f2f1 Merge feat/scripts-api-d1a-app-documents into feat/scripts-api-d3-layers-artboards
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
2026-11-21 20:00:05 -08:00
dotCooCoo ba0441c458 Scripts: addDocument takes only a DocumentPreset and throws when its profile cannot be read
- 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.
2026-11-21 14:33:43 -08:00
dotCooCoo 7c9b2a85a2 Scripts: text frames, text ranges and fonts for scripts
document.textFrames lists the document's type and makes point type, area
type and type on a path. A TextFrame gives its kind, contents, text range,
characters, words and paragraphs, outlines, and point and area conversion.
A TextRange gives its contents, offsets, sub-collections, character
attributes (size, leading, tracking, baseline shift, scales, rotation,
underline, strikethrough, font) and paragraph attributes (alignment,
indents, space before and after). app.textFonts lists the fonts.

Offsets count UTF-16 code units. A range follows edits made through these
objects and throws Stale text range after the frame's text changes
another way. Each change runs an existing text command inside the run's
transaction, and a value a range already has runs no command.
2026-11-21 13:55:18 -08:00
dotCooCoo 92cc8c77e5 Scripts: layers, groups, compound paths and artboards for scripts
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.
2026-11-21 12:05:56 -08:00
dotCooCoo 626d843520 Scripts: list the object model in the host name check, refuse zOrder inside a compound path
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.
2026-11-21 10:34:09 -08:00
dotCooCoo b2e7784160 Docs: progress line for the script checker's File setters and host test
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.
2026-11-20 19:05:54 -08:00
dotCooCoo 417ed94431 Script checker: setting a File's length, hidden or readonly counts as a file write
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/
2026-11-20 18:36:13 -08:00