Cannot convert data of type string to type string[].


#1

// renameWin contains the UI

global proc renameWin()
{

if(window -exists myWindow)
{deleteUI myWindow;}

// Window

window -title “Rename Object” myWindow;
columnLayout -adj 1 -w 300;
textScrollList -height 150 scrlList;
button -label “Add to List” -command addList addlist ;
text -l “New name:(dont add #)”;
textField newText;
button -label “Rename” -command renameList reName;
showWindow myWindow;
}
//addList puts the selected items in the scrlList

global proc adList(){
textScrollList -e -ra scrlList;
string $sel[]=ls-sl;
for($each in $sel)
{
textScrollList -e -append $each scrlList;
}
}

global proc renameList()
{
//get all objects in scrlList
string $allItmList[]=textScrollList -e -allItems scrlList;

//get the new name from the textfield
string $newName=textField -q -text newText;

//loop through objects in TSL
//and rename
for($all in $allItmList)
{
rename $all ($newName+"##");
}
textScrollList -e -ra scrlList;
}

in my script erreor shows Cannot convert data of type string to type string[].


#2

The solution is check out the shape names. Probably there are two with the same names. Rename them then try again.