Home/ Reference/ Document

doc.FileName / doc.Dirty

FileName is the file path; Dirty is whether there are unsaved changes (True/False).

Signature

doc.FileName / doc.Dirty

Notes

FileName is the file path; Dirty is whether there are unsaved changes (True/False).

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
print("Path: ", doc.FileName or "(unsaved new document)")
print("Unsaved changes: ", doc.Dirty)       # True = there are changes to save

if doc.Dirty:
    doc.Save()
    print("saved on the way out")

About this section: Document

Document — documents and file handling.

Other entries in this section