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 & InitPython
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.
- This section has 20 entries; this is one of them.
- See the full section index: Document
Other entries in this section
- doc.PagesThe page collection. doc.Pages.Count for the total, doc.Pages.Item(i)
- doc.AddPages(n)Appends n pages at the end. The idiom while len(doc.Pages) < page_inde
- doc.ActivePageThe current page object.
- doc.ActiveLayerThe active layer of the current page.
- doc.UnitDocument unit (cdrUnit). Every geometric value follows it: shape coord
- doc.ResolutionDocument resolution in dpi. Affects bitmap export and effect rendering
- doc.ReferencePointReference point for transforms. It anchors SetPosition and SetSize and
- doc.ClearSelection()Deselects everything. Call it before a batch run so you don't accident