View Single Post
# 1 05-03-2015 , 05:23 AM
Registered User
Join Date: Jul 2014
Posts: 6

Mel Syntax Question

Hey everyone, I'm currently trying to write a simple script that will change the attributes that I've added to a controller with an array but I seem to be getting the syntax wrong.

If I add a setAttr command (to make the attributes that I've made with the for loop) keyable, I seem to be getting the syntax wrong.

This is what I had:

string $mySel[] = `ls -sl`;
string $name;
int $arraySize = `size $mySel`;
for ($i = 0; $i < $arraySize; $i++)
{
$name = $mySel[$i];
select -r PLC;
addAttr -ln ($name) -at double;
setAttr -k on |PLC. + $name;
}

I know that I could just add the "-k 1" code into the addAttr command but I still need to figure out how to write the code for another part in my script.

I've tried it like

setAttr -k on |PLC.$name;
setAttr -k on |PLC.($name);
setAttr -k on |PLC. + ($name);
setAttr -k on |PLC. + \"$name\";

but seem to have no luck.

If anyone has any suggestions on what I'm doing wrong I would really appreciate the help.

Thanks in advance.