Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MEL If command syntax?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
peter_baehr97
218 Views, 2 Replies

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.

 

MEL If command syntax?

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.

 

2 REPLIES 2
Message 2 of 3
brentmc
in reply to: peter_baehr97

brentmc
Autodesk
Autodesk
Accepted solution

Hi,

 

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

Brent McPherson
Principle Engineer

Hi,

 

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

Brent McPherson
Principle Engineer
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

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;

}

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report