View Full Version : Run a command before Maya quits

12 December 2012, 06:05 PM

I made a script that calculates the time I'm spending on Maya. My problem is that I have to close Maya with a Shelf button that runs my commands and finishes by quit; but I always forget to hit it when I stop working... I just use the regular close button...

Here is my question :
Is there a way I can run some custom commands when Maya quits? Maybe by detecting an even or editing the mel file that's used for the quit command?

Thank you!

12 December 2012, 06:22 PM
string $script = "<some commands to execute>";

scriptJob -e "quitApplication" $script;

12 December 2012, 08:51 PM
I think I read a topic of someone who already wrote such a script. Maybe you should look for it.

12 December 2012, 10:36 PM
Thank you very much for your quick answers! It works great! :thumbsup:

I searched the forums but I couldn't find any topic about this... Sorry about that.

12 December 2012, 08:03 AM
hi gman,

what happens , if maya crashes ? is this "quitApplication" then working as well ?
have a nice day ;)

12 December 2012, 08:46 AM
Of course not (were you joking?); to handle crashes you need something like:

12 December 2012, 11:38 PM
guess , it was just too early in the morning , and i was still dreaming ..... ;)
have a nice week :)

CGTalk Moderation
12 December 2012, 11:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.