Hi Melon-
I also have procedures to add and remove items from a given textScrollList.
//Procedure adds selected objects to a given textScrollList.
global proc dwAddSelectedObjectsToList (string $textScrollListName)
{
//find out what exists in textScrollList.
string $textInScrollList[] = textScrollList -q -ai $textScrollListName
;
//find out what´s selected in scene.
string $currentMayaSelection[] = ls -sl
;
if (size($currentMayaSelection) == 0)
error “Nothing selected.”;
//remove all items from textList (need to “refresh” list).
textScrollList -e -removeAll $textScrollListName;
string $allSelectedArray[] = stringArrayCatenate $textInScrollList $currentMayaSelection
;
string $cleanedSelection[] = stringArrayRemoveDuplicates $allSelectedArray
;
for ($current in $cleanedSelection)
{
textScrollList -e -append $current $textScrollListName;
}
}
…and to remove selected items from list:
//Procedure to remove selected elements from a textScrollList.
global proc dwRemoveObjectsFromList (string $textScrollListName)
{
string $currentTextSelection[] = textScrollList -q -si $textScrollListName
;
if (size($currentTextSelection) == 0)
error “Nothing selected in text list.”;
for ($currentText in $currentTextSelection)
{
textScrollList -e -ri $currentText $textScrollListName;
}
}

David