Marked 3.2.14 (1232), Mac App Store, macOS 26.5 (via Claude Code)
With several documents open, export always exports the first document in the list, whichever document the script names. I had four documents open, in this order: closetestA.md (just opened), board-update-2026-09-28.md, marked-share-table-test.md, and status.md. Each of these three commands wrote a PDF of closetestA.md, and the three PDFs were byte-for-byte the same size:
tell application "Marked" to tell document "board-update-2026-09-28.md" to export paginated pdf to POSIX file "/tmp/a.pdf"
tell application "Marked" to tell document 3 to export paginated pdf to POSIX file "/tmp/b.pdf"
tell application "Marked" to tell (first document whose name is "board-update-2026-09-28.md") to export paginated pdf to POSIX file "/tmp/c.pdf"
The specifiers themselves resolve correctly: get name of document 3 returns marked-share-table-test.md. It is only export that ignores the target. Earlier in the same session, an export addressed to marked-share-table-test.md produced a PDF of board-update-2026-09-28.md, which was document 1 at that moment.
This matters for scripts because the wrong document is exported without any error. My workaround is to open the file immediately before exporting, since a newly opened file becomes document 1, and to export document 1.
I couldn't tell whether export uses the first document in the list or the frontmost window, since in every test the first document was also the one most recently opened. What I'd expect is that tell document X to export ... exports document X.