multiple commands button



I’m kind of new to MEL, and I was wondering if someone could point me in the right direction with a UI I’m working on.

Basically, I want to be able to close a window and perform an action at the same time.

I was following this thread:
which seems to be very much like what I wanted, except that my “OK” function is a string.

Here’s what I’ve got:

$Window = `window -title "Window"
-iconName "Locator"
-widthHeight 200 50`;
	$OK = ("deleteUI " + $Window);

	button -label "OK" -command  $OK;
	showWindow $Window;

global proc Proc2( ) 


spaceLocator -p 0 0 0;


How do I get it to run Proc2 while closing the window?

Thanks in advance for the help.

button -label "OK" -command  "$OK; Proc2;";

That should work for ya. The command flag in the button command is like a string of mel, you can do anything in it, you don’t even need to make procs if you don’t want. But procs are the way to go anyway.


hmm, it’s still giving me a syntax error.

// Error: $OK; Proc2; //
// Error: Syntax error //


This is your fix, let me know if you need an explanation.

	$OK = ("deleteUI " + $Window + "; Proc2;");


Thanks, that worked perfectly!


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.