Commit Graph
5 Commits
Author SHA1 Message Date
dotCooCoo db7fe4d38b Scripts: tracing keeps added images and direct selections; app.open logs warnings
- Expanding a tracing removes only its source image; other images a script
  moved or duplicated into the group stay.
- A TracingObject goes stale when its original source image is gone, even
  when another image now sits first in the group.
- Tracing, retracing, expanding and releasing restore the whole selection,
  anchors and segments included, with only the replaced object remapped.
- app.open writes the open's warnings to the script console, as saveAs does.
- embed() checks the image's link state after the command instead of a
  returned id rounded to a JavaScript number.
- The placed-image tests pass ordinary drive paths to File on Windows.
2026-11-29 17:02:07 -08:00
dotCooCoo 64972e8a91 Scripts: saveAs logs the save's warnings; exact grants cover linked files; a tracing's source stays first
- Document.saveAs writes each warning file.saveAs gives to the console as a
  line that starts with "saveAs: ", and still returns undefined.
- A save, export or open of a File the script names no longer reads a file
  an open document links to outside the script's grants.
- A save or export that writes several files checks that no folder is where
  one of them goes before it writes the first, so none of them is written.
- Moving the source image of a tracing within its tracing, and zOrder on it,
  leave it first; zOrder SENDTOBACK on another object in a tracing puts it
  just above the source.
- The two new script file errors are English only; their catalog rows are
  removed (translations go through storytold/craft-i18n).
2026-11-29 15:49:36 -08:00
dotCooCoo fde921a744 Scripts: review fixes for tracing, placed items, saves and the New Document layout
- The Image Trace panel's lookup test skips an Image Trace object's source
  image, as imageTrace.make does since trace() came in.
- A save of several files refuses a path the file access in force refuses
  before any file is written, whatever writer the caller gives.
- move and duplicate look a page item up through its class, so a PlacedItem
  that was embedded is stale as the relative object.
- PLACEATEND into an Image Trace object puts the object directly above the
  source image, which stays the first child.
- controlBounds takes in the anchors and Bezier handles of the item's paths.
- The file of a PlacedItems.add() result is stale once its document closes.
- Assigning PlacedItem.file reads the placed image's id from the command's
  own result, so an id above 2^53 binds and clears exactly.
- The enumerations the save and export option defaults name are registered,
  with the members the scripting constants page lists.
- A tracing replaced twice and then undone is followed to the one the
  document holds.
- Choosing the artboard layout in force again keeps a preset's rows.
- docs/mcp.md and docs/gaps.md describe controlBounds, a null preset for
  addDocument, the view options and scripted tracing.
2026-11-22 07:44:39 -08:00
dotCooCoo d14830b6b7 Scripts: saveAs and exportFile refuse a file open for writing and scales under 1%
A save or export to a file that a File object holds open for writing throws "Script file is open for writing", and a command the script runs does not write such a file besides the one named (an SVG's images), so the bytes the File writes at the end of the run do not replace the output. horizontalScale and verticalScale take 1 to 776.19, since a raster export writes at least 0.01 pixels per point.

The script checker reports a document's saveAs and exportFile as file writes, and the host name check lists the save, export and open names, option classes and enumerations.
2026-11-21 17:36:55 -08:00
dotCooCoo 55f7dc9205 Scripts: Document.saveAs, Document.exportFile and app.open with option classes
Scripts save, export and open documents through Document.saveAs,
Document.exportFile and app.open, with IllustratorSaveOptions,
EPSSaveOptions, PDFSaveOptions, ExportOptionsPNG24, ExportOptionsJPEG,
ExportOptionsSVG and a PDFFileOptions record, the ExportType and related
enumerations, and app.userInteractionLevel. Each method runs file.saveAs,
document.export or document.open inside the run's transaction.

- A File argument reaches the host as its path only when the File class
  made it: the path is held in an internal slot that scripts cannot set,
  and a plain object that imitates a File is refused.
- Each path is checked as a File opened for reading or writing would be,
  before the command runs, and the command's own reads and writes are then
  held to the script's grants, leaving out the open documents' files.
  A read-only file is not written over.
- Options a command maps are applied; a listed option that is not mapped
  is accepted only at its documented default, and any other value, a bad
  type or an out-of-range number throws before anything is written.
  Without options, saveAs to a .ai, .eps or .pdf path and exportFile as
  PNG24, JPEG or SVG use the defaults a new options object holds. With
  pDFPreset named, a PDFSaveOptions option still at its default keeps the
  preset's value. A raster export at 100% has one pixel per point.
- An export or save that writes several files, such as an SVG that writes
  its embedded images beside it or an EPS with a file per artboard, checks
  every path before writing the first.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-21 13:51:09 -08:00