Mel To Switch To Object Mode

I have a hotkey to escape back to object mode always, I use ~ key with following command:

string $selection[] = ls -sl;
changeSelectMode -object;
select -r $selection;

However this doesn't work if the commonent mode was acessed by right click on object -> vertex for example, I have to press it twice just like press F8 twice its annoying(essentially switching to comonent and back to object again). I want a key that switch back to object mode no matter the case. anyone?

That's because entering component mode thru right click menu doesn't really change the selection mode. It just put the object into hilited state for component selection. You can unhilite everything that is hilited with:

CODE
hilite -u ls -hilite;

QUOTE(yinako @ 01/16/06, 05:30 AM) [snapback]225025[/snapback]
I have a hotkey to escape back to object mode always, I use ~ key with following command:

string $selection[] = ls -sl;
changeSelectMode -object;
select -r $selection;

However this doesn't work if the commonent mode was acessed by right click on object -> vertex for example, I have to press it twice just like press F8 twice its annoying(essentially switching to comonent and back to object again). I want a key that switch back to object mode no matter the case. anyone?

I have this script on my F8 key and it ALWAYS goes back to object mode no matter what (having F8 as a toggle just seems dumb to me):

CODE
toggleSelMode;
toggleSelMode;
selectMode -object;

:nathaN