Execute code on Maya exit

66 views
Skip to first unread message

Fredrik Averpil

unread,
Apr 23, 2015, 3:56:55 AM4/23/15
to python_in...@googlegroups.com
Does anyone know if it is possible to tell Maya to execute a function when it exits?

Regards,
Fredrik

Mahmoodreza Aarabi

unread,
Apr 23, 2015, 3:58:26 AM4/23/15
to python_in...@googlegroups.com
I think there is a ScriptJob for this.
And i think this is discussed earlier in this group.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWPWT4F8Lxvyb2jcK%2Bcs5u1dGVFLhzshFcsJuubOsC0qaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--


Bests,
madoodia

Fredrik Averpil

unread,
Apr 24, 2015, 9:33:27 AM4/24/15
to python_in...@googlegroups.com
Yes, I believe you're right. I managed to run a custom function on exit using:

cmds.scriptJob(e=['quitApplication', myFunction] )



Marcus Ottosson

unread,
Apr 24, 2015, 9:55:24 AM4/24/15
to python_in...@googlegroups.com
The only thing to keep in mind that it won't run if Maya crashes. For that, you need to resort to the OS, or a cross-platform library like psutil.


For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Fredrik Averpil

unread,
Apr 24, 2015, 10:35:44 AM4/24/15
to python_in...@googlegroups.com
Yep. For what I'm doing, that's perfectly fine.

Mahmoodreza Aarabi

unread,
Apr 24, 2015, 3:48:00 PM4/24/15
to python_in...@googlegroups.com

thanks Fredrik `for remembering
i learnt it again
;)



For more options, visit https://groups.google.com/d/optout.



--


Bests,
madoodia
Reply all
Reply to author
Forward
0 new messages