Mel passing textFieldGrp text to proc


Hey guys and gals,

I am wrote a script that creates a hirarch of groups and want to add a UI that lets the user enter a name for the groups. I don’t understand how to geht the test out of my textfield though. The name of the thextfield is passed on the the second procedure correctly but i allway get an error. I am sure the solution is quite simple, I can’t figure it out myself though. I’d appreciate if someone coule help me.

global proc jl_groupHirarchyUi ()
//create window
$win = “jl_groupHirarchyUI”;
if (window -exists $win)
deleteUI $win;
window -title “Named Group Hirarchy” $win;
columnLayout -adj true;
//save name of textfield to variable
$textFieldName = textFieldGrp -l "Character Name:" -text "Editable";

//create button with function        
$button = `button   -l "Go" -c ("checkText\" "+$textFieldName+"\"")`;
showWindow $win;


global proc checkText (string $cN)
// get the results
string $charName;
print ("
$cN is: " + $cN + "
$charName = textFieldGrp -q -tx $cN;

    //execute procedure that creates group hirarchy
    $cmd = ("jl_groupHirarchy");
    evalEcho $cmd;



There is a little error in line 13. It would also be better to get used to declare variables specifying their types.


Thanks zaskar,

I got most of the code from ohter scripts.I’m guessing (“checkText” “+$textFieldName+”"")`; ist the part that has the error in it but I honestly don’t understand that part at all.


What makes me wonder the most is the fact that the script works. even when I hit the button it prints out the correct name of the thextfield I am tryint to read. I just get // Error: file: C:/Users/…/Documents/maya/2012-x64/prefs/scripts/jl_groupHirarchyUi.mel line 34: Object ’ jl_groupHirarchyUI|columnLayout3|textFieldGrp3’ not found. / as an error.


That part is simply a procedure call:

checkText "controlFieldName"

but having the control field name inside a string and to hand it over as argument, the procedure call itself has to be a string and it gets:

("checkText \"" + $controlField + "\"");

although if maya knows that the procedure “checkText” receives a string you wouldnt need such a stunt and you can omit the quotation marks:

("checkText " + $controlField);

As you see if you want to put quotation marks into a string you need to use a backslash

string $str = "\"";

now find the error


I kinda get it but not really :). It’s working though. THX zaskar.


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.