Automatic File Saving with Timestamp

Up to now, I have not touched Python code and may be using the wrong terms in the discussion below.

The ability to save files with a timestamp is valuable to me. As I reach landmark points with my .blend file, I save it to disk with a timestamp. This allows me to use the same filename as the timestamp always changes.

I would like to create a script/plugin that would place a button on the screen which, when clicked, would automatically populate the filename field in a Save As… dialog. The name would be a base name plus a dash character plus a timestamp (to the minute).

Click the button the first time and you be asked to supply a base name, if the current .blend file is a new document. If working on an existing sheet, “test file”, a Save As… dialog will appear with the name+timestamp field populated. (Ex. “test file-144408252005”)

The macro would be simple: extract the base name, extract the system time, call the File->Save As… function.

Can anyone help me with references where I can learn the basics of interfacing with Blender using Python code? Animation has been my sole concern up to now. Necessity is the mother of invention!

Thanks, Bob

The best way to learn python imho is to start looking at the code of other scripts and try to understand what they do. Then try to alter simple things and slowly get to the point where you can start creating your own scripts.
But it’s of course always handy to have a good starting point and some references so here are some links:

Creating your first python script. (by jms)- at the moment only the parts up to and including 4 are working, but I really suggest you start with these.
A list of all commands, with their explanations
Also a search on python AND tutorial will bring up some interesting stuff here on elysiun.

About the script you need:
This can be easily made except from one thing: the exact time. Blender keeps track of time from a certain point, but not of the real time. See the api for the exact wording. So unless anybody else knows a good solution for this I think you’ve got a bit of a problem at the moment.
Perhaps it’s possible to import the operating system time in some way, but one of the good coders (jms or cambo for example) will have to answer this.

Necessity is the mother of invention!

Without a doubt. Good luck and have fun!

EDIT: I nearly forgot to link to the masterlist of tutorials, enjoy.