I'd been thinking about this problem for a while, but this post gave me the idea, at last. I tried to whip up some code, it might be buggy though, and I haven't really tested it. Go ahead and try it!
Cheers,
Horvatth, Szabolcs
global proc string [] sz_ReturnComponentSelectionInOrder () {
string $selectionAll[] = ls -sl
;
int $counter = 0;
string $selection[];
string $realSelection[];
clear $selection;
string $buffer[];
for ($i = 0; $i < 100; $i++)
{
string $lastCommand = `undoInfo -q -un`;
if (`match "select" $lastCommand` != "")
{
tokenize $lastCommand " " $buffer;
$selection [$counter] = $buffer[2];
$counter++;
undo;
}
}
//print ($counter + " items in undo queuen");
select $selectionAll;
for ($i = 0; $i < `size $selection`; $i++)
$realSelection [(`size $selection`- $i)] = $selection[$i];
return $realSelection;
}