there are a variety of ways to do this.
First, you can create your own function…
def mySaveScene():
# do some stuff
cmds.file(save=True)
# do some more stuff
you can hotkey this to CTRL-S, however the File Menu option won’t call this, and the Status Bar icons won’t use it either.
Another way is to use Script Jobs, although you don’t have control over whether the script runs before or after the save operation. I don’t recall when Maya runs the script when a file is Saved.
Thirdly, you can copy the Save File MEL script from Autodesk’s folder and put in your local folder and edit that file, but I would discourage that approach.
Lastly, there is a concept in Maya of a “RunTimeCommand” - you can think of this as an alias to some code. It’s basically a layer that sits between Maya’s UI and the code it runs. RunTimeCommands are what you see when you go into the HotKey Editor and assign hotkeys to functions.
Maya has a default RunTimeCommand called “SaveScene”. If you could somehow edit that RunTimeCommand, you can alter Maya’s Save Scene function AND also update all Hotkeys, Shelf Buttons, Menus and Icons in one stroke.
However, default RunTimeCommands cannot be edited after they are created… so… what you can do is copy Maya’s “defaultRunTimeCommands.mel” file into your local folder and edit the “SaveScene” and “SaveSceneAs” runtime commands to perform your operations before and after and won’t have to worry up about updating the File Menu, Status Icon, Hotkeys, custom Shelf Buttons, etc.
I recently used this last approach to run a maya ascii file scrubber each time the file is saved.