MEL If command syntax?

MEL If command syntax?

peter_baehr97
Contributor Contributor
539 Views
2 Replies
Message 1 of 3

MEL If command syntax?

peter_baehr97
Contributor
Contributor

I am trying to use an if command but Maya will keep telling me there is a syntax error. I think I use the wrong symbols around the condition of the if command, but i can't figure out whats the correct one.

 

The script is supposed to check if the Window "rigWindow" exists, and if the answer is yes i want to close it.

The script that does not work:

 

if ('window -exists rigWindow')
(
deleteUI rigWindow;
)

 

I tried multiple different things but its frustrating as this seems like  a minor mistake. Can someone tell me what the correct syntax for this command would be? Greatly appreciating any help.

 

Accepted solutions (1)
540 Views
2 Replies
Replies (2)
Message 2 of 3

brentmc
Autodesk
Autodesk
Accepted solution

Hi,

 

You need to enclose the window command in backticks (`) not single quotes. (')

Brent McPherson
Principle Software Developer
Message 3 of 3

peter_baehr97
Contributor
Contributor

Thanks for the Reply! Its working now. I also exchanged the normal brackets with {}.

For anyone who has the same problem this is what the correctly working script looks like:

if ( `window -exists rigWindow` )

{

   deleteUI rigWindow;

}

0 Likes