From 048d55f1f5213f5cef26c0be64b1d5808bb28638 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 02:16:48 -0800 Subject: [PATCH] Scripts: print on a document from documents.index counts as a file write The script checker now treats documents.index() and app.documents.index() as chains that give a document, so print on one records file.write and filesWritten like the other document chains. --- crates/scriptcheck/src/catalog.rs | 4 +++- crates/scriptcheck/src/tests.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/scriptcheck/src/catalog.rs b/crates/scriptcheck/src/catalog.rs index ad3931117a..136b01d667 100644 --- a/crates/scriptcheck/src/catalog.rs +++ b/crates/scriptcheck/src/catalog.rs @@ -84,7 +84,7 @@ pub(crate) const DOM_PRINT: &str = "print"; // The member chains that give a document, whole and as the chains are written (`[]` for an index, // `()` for a call): https://ai-scripting.docsforadobe.dev/jsobjref/Application/ (`activeDocument`, // `documents`, `open`) and https://ai-scripting.docsforadobe.dev/jsobjref/Documents/ (`add`, `addDocument`, -// `addDocumentNoUI`, `getByName`). +// `addDocumentNoUI`, `getByName`, `index`). pub(crate) const DOM_DOCUMENTS: &[&str] = &[ "activeDocument", "app.activeDocument", @@ -98,6 +98,8 @@ pub(crate) const DOM_DOCUMENTS: &[&str] = &[ "app.documents.addDocumentNoUI()", "documents.getByName()", "app.documents.getByName()", + "documents.index()", + "app.documents.index()", "app.open()", ]; diff --git a/crates/scriptcheck/src/tests.rs b/crates/scriptcheck/src/tests.rs index c833ccb540..e3c617037c 100644 --- a/crates/scriptcheck/src/tests.rs +++ b/crates/scriptcheck/src/tests.rs @@ -579,8 +579,10 @@ fn print_writes_a_file() { "app.documents.addDocument('Print', s, false).print(o);\n", "documents.addDocumentNoUI('Print').print(o);\n", "app.documents.addDocumentNoUI('Print').print(o);\n", + "documents.index(0).print(o);\n", + "app.documents.index('Untitled-1').print(o);\n", )); - let lines = &[2, 3, 5, 9, 10, 11, 12, 13, 14][..]; + let lines = &[2, 3, 5, 9, 10, 11, 12, 13, 14, 15, 16][..]; assert_eq!(feature(&r, "file.write").map(|f| f.lines.as_slice()), Some(lines)); assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::>(), [("filesWritten", lines)]); }