View Full Version : How should I exit confirm Dialog and launch SaveSceneAs

07 July 2012, 11:25 AM
I encounter a strange problem

// create a confirm dialog with a yes and no button. Specif
$response = `confirmDialog -title "Confirm"
-message "Yes or No? It's your choice..."
-button "Yes"
-button "No"
-defaultButton "Yes"
-cancelButton "No"
-dismissString "No"`;

// check response
if( $response == "Yes" ) {
print("User says yes\n");
} else if( $response == "No" ) {
print("User says no\n");

according to above code if user press yes the confirm dialog should go away and SaveSceneAs should open, but instead the confirm Dialog box stays and SaveSceneAs opens behind my confirm Dialog box, whats strange if I exit by clickin on close on upper right corner of my confirm dialog box the response is printed No even though I pressed Yes which launched SaveSceneAs and then sometimes maya 2013 crashes...

07 July 2012, 12:33 PM
your example code works fine and as expected on 2010, so they either "broke" something in the confirmDialog command or the SaveSceneAs RunTime funtionality in 2013.

try doing an evalDeferred on the SaveSceneAs and see if that helps. When I had to convert our tools from 2010 to 2012 I had to put loads of evalDeferred in things to avoid crashes and odd behaviour.

07 July 2012, 01:22 PM
Thank you, that saves me..
I am ATM in process to update some of my old mel scritps .

How did you first learnt about evalDeffered(...)?

CGTalk Moderation
07 July 2012, 01:22 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.