Heres the one I use, its a lot better. do the script editor thing. ____________________________________________ // declare variables string $selected[]; string $hilited[]; string $object; int $test[]; int $hold; // assign values to variables for selected objects $selected = `ls -sl -dag -ap -typ surfaceShape`; $hilited = `ls -hl -dag -ap -typ surfaceShape`; // loop through any objects in component mode // and toggle their x-ray display for ($object in $hilited){ $test = `displaySurface -q -xRay $object`; $hold = $test[0]; if ($hold != false) displaySurface -xRay false $object; else displaySurface -xRay true $object; // clear test variable clear $test; } // loop through any objects in object mode // and toggle their x-ray display for ($object in $selected){ $test = `displaySurface -q -xRay $object`; $hold = $test[0]; if ($hold != false) displaySurface -xRay false $object; else displaySurface -xRay true $object; // clear test variable clear $test; } // clear selection variables clear $selected; clear $hilited; // Result: 0 //