How to detect if project has unsaved changes?
I need to test if there are unsaved changes to the project in the After Effects application. Is there any way to do that? I get really close with this hacky solution -- save the project to a temp location and compare it to the current project:
function projectHasUnsavedChanges() {
if (!app.project || !app.project.file) {
return false;
}
var currentFile = app.project.file;
// create_uuid pulled from https://stackoverflow.com/questions/105034/how-to-create-guid-uuid
var tempProjectFile = new File(Folder.temp.fsName + '/' + create_uuid() + '.tmp.aep');
app.project.save(tempProjectFile);
var filesIdentical = byte_compare_files(tempProjectFile, currentFile);
tempProjectFile.remove();
return !filesIdentical;
}
This solution has a huge side-effect making it unacceptable. Basically whenever .save() is called, it changes the After Effects active project file to the saved location. Furthermore it adds the saved file to the recent history. Given I am just trying to do a test for unsaved changes, this doesn't work.
Are there any other options out there?
Thanks!