Hello there. I'm trying to make a script to toggle between smooth shaded and wireframe. So far, I can take it half way (shaded to wireframe). However, I can't go back using it. I'm sure that I've done something wrong with the If/Else command, but for all I know, it could be something else (in case you haven't guessed by now, I'm very, VERY new to MEL). Here's what I have so far:
The problem is that your 'if' line isn't measuring something, it's actually changing something. The command you've got in forward quotes uses the edit flag instead of the query flag. Since this edit will always return a true result, the consequent statement always executes, reverting the panel back to wireframe. The 'else' line never executes.
Try this line instead:
if (`modelEditor -q displayAppearance modelPanel4` == "smoothShaded")
Beware, though: the fact that you refer explicitly to 'modelPanel4' means you will always be affecting the same panel, making the query to find the active panel useless.