Hidden status of objects

Is there a way using MEL to determine if a selected object is hidden or not? I'm trying to make a 'toggle hidden/not-hidden' hotkey. The hide command can't be queried and the toggle command doesn't seem to work for all objects and also doesn't seem to do the same thing as hide (but works for geometry).

Thanks

The hide command just sets the visibility attribute on the mesh. So you just need to query that attribute to test if an object is hidden or not.

hide pCube1;
getAttr pCube1.visibility;
// Result: 0 //
showHidden pCube1;
getAttr pCube1.visibility;
// Result: 1 //

g-