Windows UI close event?

I am wondering if there is anyway to tell when you close Maya window UI.

I need to be able to run a script / script job when user click on X to close the window in Maya. I can’t seem to find any events that are triggered by this action.

One method that I can think of is to continuously listen to see if the window exists , but that is just but too lame way.

Does any one know how this can be done? Possible work around?

thanks.:laugh:

I just found scriptjob uiDeleted… I will try this. :smiley: why did I not see that before :smiley:

[QUOTE=Castor;4892]I just found scriptjob uiDeleted… I will try this. :smiley: why did I not see that before :D[/QUOTE]

The one thing i’d point out about firing scriptJobs on UI close is to be careful about parenting the scriptJob to the UI. In some instances this crashes Maya.

Yes, thanks for the advice. It does indeed sounds like a loop to me too. I will make sure it is created outside UI function.