PDA

View Full Version : Run a command before Maya quits


gmangmangman
12-09-2012, 05:05 PM
Hello!

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!

Nyro
12-09-2012, 05:22 PM
string $script = "<some commands to execute>";

scriptJob -e "quitApplication" $script;

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

gmangmangman
12-09-2012, 09: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.

tonytouch
12-12-2012, 07:03 AM
hi gman,

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

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

http://forums.cgsociety.org/showthread.php?p=7276807#post7276807

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

CGTalk Moderation
12-16-2012, 10: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.