Detect if it is AutoSave when OnPreSave / OnSave / OnPostSave called?


I just notice that OnPreSave / OnSave / OnPostSave methods are called wether the user trigger a standard save operation or when Sketchup save the file through AutoSave method.

I can’t find a way to differentiate the calls and find out if it is a user operation or an autosave operation.

Is there any way to achieve that?


I’m afraid the API doesn’t provide that ability to detect this.

(I’d encourage you to file a feature require in our issue tracker:

1 Like

as you can get the path to both files you could compare File.ctime # or mtime


1 Like

This is an excellent workaround that nearly does the trick.
Anyway a problem is remaining.

When saving for the first time on a newly created scene that does have name, model.path remains empty in onPostSave methods.
The filename is attached to the model after the onPostSave method call, which is definitively a strange behavior. onPostSave should access to the details of the save operation as it has been completed.

So this workaround only works from the second save, where the model.path is correctly defined.

1 Like

Yea, the pre/save/post events isn’t triggering cleanly…

1 Like