Ok this should get you going Copy & past this to the script editor then middle mouse button drag to your shelf. string $sel[]; int $temp[]; int $value; $sel = `ls -sl -dag -ap -typ surfaceShape`; for ($obj in $sel){ $temp = `displaySurface -q -xRay $obj`; $value = $temp[0]; if ($value == 1) displaySurface -xRay 0 $obj; else displaySurface -xRay 1 $obj; }