View Full Version : Learning MEL ..Cant solve this error
ankitsharma 12-26-2010, 04:14 PM Hello,
Just started learning MEL ..
tried making this reamer script
the problem is it does the job but it gives me a error at the end saying
// Error: No object matches name //
string $whatzPicked[] = `ls -sl`;
int $i = `size $whatzPicked` ;
int $j;
for ($j=0 ;$j<=$i; $j++)
{
string $fullname = ("rice_" + $j);
rename $whatzPicked[$j] $fullname;
}
Can some one guide me what is wrong in my basic coding :)
thanx in advance :arteest:
|
|
Joviex
12-26-2010, 05:24 PM
Hello,
Just started learning MEL ..
tried making this reamer script
the problem is it does the job but it gives me a error at the end saying
// Error: No object matches name //
Can some one guide me what is wrong in my basic coding :)
thanx in advance :arteest:
The problem looks like your code runs at least one time, and if there is no object named (in the default case) "rice_0" it is telling you that object does not exist.
The potential problem is:
$j<=$i
On the first evaluation, if $i=0 (no objects), then it will still run through the loop at least once because $J also = 0.
What you can do to eliminate this case:
int $i = `size $whatzPicked`-1;
OR change:
$j < $i;
both are mutually exclusive.
p.s. using the php blocks = I cant read your code unless I highlight it on screen. Try using code ... /code instead
HTH
ankitsharma
12-27-2010, 09:55 AM
Right... thanx a tone joviex for pointing it out.... index in a array start at zero...
and yeah that php thing is really eye straining...
regards
ankit sharma
CGTalk Moderation
12-27-2010, 09:55 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.