Hi
Please look at this part. I get an error with the substitute command
//GET THE SELECTION
string $wholeSel[] = `ls -sl`;
//FILTER ONLY TARGET OBJECTS AND GET THEIR SHAPE NODES
string $targetList[] = ls("-sl", "-hd", (size($wholeSel) - 1));
//GET THE BASE OBJECT
string $base = $wholeSel[size($wholeSel) - 1];
//DUPLICATE THE BASE
string $dupList[];
string $baseCopy[];
for ($i=0; $i<size($targetList); $i++)
{
$dupList = `duplicate -rr -st $base`;
$baseCopy[size($baseCopy)] = $dupList[0];
}
//RENAME THE BASE DUPLICATES TO THE TARGET NAMES
string $newBaseCopy[];
for ($d=0; $d<size($baseCopy); $d++)
{
rename($baseCopy[$d], (substitute("_L1", ($baseCopy[$d] = rename($baseCopy[$d], $targetList[$d])), "_R"))); <-ERROR HERE
}
with this I only get my first object in the array renamed ONCE, but the second rename doesnt happen. “No object matches name”
Also sometimes I get substitute command eror saying to check arguments type. this happens only in this case. if I simplify the code with just variables instead of functions the erroe goes away and i get good result.
I also want to say that I am learning still.
Thank you
