2009

Table Of Contents
Window naming
As user interface scripts get more complex, it is possible that you may make
a syntax error. If a user interface script partially executes and halts on an error,
the window still exists, but the window is not visible. If you fix the problem
and would like to execute the script again, you must either give the window
a new name, or delete the hidden window.
Resolving naming conflicts
In the next section, you use conditional statements to resolve window naming
conflicts. Conditional statements allow a section of code to execute depending
on the value of a variable or the state of an object in the scene.
To resolve conflicting window names
1 Create a window with a scripting error inserted before the showWindow
command by typing the following in a MEL tab of the Script Editor:
window testwindow; fake_command; showWindow;
An error is output to the Script Editor.
// Error: line 2: Cannot find procedure "fake_command;". //
The window is not displayed, but still exists.
2 Create another window with the same name by typing the following in
a MEL tab of the Script Editor:
window testwindow; showWindow;
An error is output to the Script Editor.
// Error: line 1: Object's name is not unique: testwindow //
All objects in Maya and user interface elements must have unique names.
To query a windows existence
1 Type the following command in the Script Editor input section, to delete
the hidden window:
deleteUI testwindow;
2 Check if the window exists by typing the following command:
window -exists testwindow;
The following result is output to the Script Editor.
// Result: 0 //
Window naming | 627