Command to detect if open file was changed?

Nothing complicated here. I have a few scripts in PanX that add single records to another database. If the database isn’t already open it gets opened. Works fine, but the database where the record is added via script doesn’t seem to get “dirty”. It doesn’t recognize there was a change and if I am stupid enough to not save it manually I lose the changes. Is there a “dirty” flag I can set in the destination database?


I think this will do it.

opendatabase "some database"
startdatabasechange "allrecords"

Apple’s NSDocumentClass only thinks a document is “dirty” if there has been an undoable change.

A related question that has been in the back of my mind is whether the Save
statement reliably writes the current state of the database to disc regardless of whether the operating system (or Panorama) thinks the file is “dirty” (changed) or not?

Yes, the save statement doesn’t care if the file is dirty or not. The dirty status only affects auto-save. In Peter’s example he was not explicitly saving, he was relying on auto-save, and auto-save is tied to undo-able user actions.

An alternate fix for Peter’s original problem would be:

opendatabase "some database"
1 Like

I ended up using “save” after addrecord. Thanks