global proc selfGenEx() { string $winName = `window -title "Self Generating code example" -rtf 1`; columnLayout ; rowLayout -nc 2 -columnWidth2 150 150; text -label "Attribute to Set"; textField -width 150 attName; setParent..; rowLayout -nc 2 -columnWidth2 150 150; text -label "Value to set"; textField -width 150 val; setParent..; button -label "Add button" -command "makeButton()"; separator -width 300; columnLayout buttonList; showWindow $winName; } global proc makeButton() { // grab the list of currently selected objects string $temp[] = `ls -sl`; // store the first item in the $objectName variable string $objectName = $temp[0]; // grab the attribute name string $attribute = `textField -query -text attName`; // grab the attribute value string $value = `textField -query -text val`; string $command = "setAttr \""; $command += $objectName; $command += "."; $command += $attribute; $command += "\" "; $command += $value; string $label = "Set "; $label += $objectName; $label += "."; $label += $attribute; $label += " to "; $label += $value; button -width 200 -parent buttonList -label $label -command $command; }