- Document.fullName is a File for the document's file, and Document.path a
Folder for its folder. A document without a file has a fullName of a
File for its name in Folder.current and a path of "". Both throw
`Script file access denied` with the document's name when the
automation read roots do not allow the file.
- Document.saved reads whether the document has unsaved changes. Setting
it runs the new command document.setSaved, which records the document
as saved or as changed without saving it and adds no undo step.
- Document.close(saveOptions) closes a document without unsaved changes
with any SaveOptions value. With unsaved changes,
SaveOptions.DONOTSAVECHANGES closes it without them, and
SaveOptions.SAVECHANGES saves them first with file.saveAs, in the
format the file's extension names and after the write-access check
saveAs makes, and throws for a document without a file (a converted
or recovered one included). SaveOptions.PROMPTTOSAVECHANGES, the
default, throws, since a script cannot show the prompt.
- The script checker reports SaveOptions.SAVECHANGES under filesWritten
wherever the script reads it.
- A pDFPreset in square brackets, such as [Smallest File Size], names
the built-in preset of the name inside them.
- artboardRange takes a whole number from 1 as well as a string; any
other number throws.
- With saveMultipleArtboards true, a .ai or EPS save also writes each
artboard of the range to a file of its own. Without it the range is
not used, but text that is not a range of artboard numbers throws.
Document page: https://ai-scripting.docsforadobe.dev/jsobjref/Document/
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.
- 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/