MEL How-To #29

Back · Previous · Next Maya

How can I get Maya to execute a command as soon as a window is closed?

The ‘scriptJob’ command has a flag for this purpose:

window -title "Close Me" myWindow;
showWindow myWindow;

// Use a scriptJob to pop up a farewell message when the window is closed
scriptJob -uiDeleted myWindow "confirmDialog -message \"Buh-bye!\"";

The scriptJob is automatically deleted with its associated UI.