Reply to: Saved propertyNovember 23, 2011 at 7:04 pm
Good example. Reproducible here immediately. Thanks.
Looks to me like it is an issue triggered by the “undo after save” feature introduced with 5.x that is the cause.
When you call ActiveDocument.Save() the document is actually being saved, and the status of ActiveDocument.Saved property seems to be set to true (at least for an instant), however there is a mismatch going on somewhere that causes the Saved property either to not be remembered as true, or that is causing it to be undone. The GUI is only updated when the script is finished running (that's normal) and so by that time the saved state is already wrong (when the toolbar icons are being set for those that indicate status).
I will file a defect report so that dev can look at it.
Immediate fix that should hopefully resolve the issue is to disable the “undo after save” feature with an INI setting or API property. Your users did not have this feature with 4.6 so they might not miss it. These are undocumented as we expected everyone to love the new undo capability and not want to disable it, but since it breaks your script…
The INI setting is this:
always_undo_clear_after_save = true
The API is:
Application.AlwaysUndoClearAfterSave = true
It is probably best called in an application start-up event. You may try setting it in a document-level event too. In either case it disables the undo after save feature for the entire application (for all documents regardless of document type).
I would recommend using only one of the above (you only need one). Because they are undocumented I'm not sure how they interact with each other (which takes precedence). They were likely added because the new undo past save feature was really hard to code and test so dev wanted a way to bypass it in an emergency (which is the case here).