ControlInfo / FindValue don't generate variables

Hey!

I tried to make a temporary function to get all checkboxes's names in a window and use them with ControlInfo to get their Titles, so I could use it to change a wave containing this information. The problem is that ControlInfo don't create any variables when executing inside the For loop, neither FindValue. I tested just these commands in the command window, works fine.

It ends up in an error because S_title is empty.

Why these functions don't generate the variables inside the loop? Code bellow:

Function aux()
    variable controlnumber
    variable windex
    variable i
    string controllist
    string controltitle
    string controlname
    wave/T wPDG = root:VarList:wPDG
   
    controllist = ControlNameList("PreDefinedGroups")
   
    for(i=0;ItemsInList(controllist)>i;i+=1)
        if(StringMatch(StringFromList(i,controllist),"group*"))
            continue
        else
            controlname = StringFromList(i,controllist)
            ControlInfo/W=PreDefinedGroups controlname
            FindValue/TEXT=S_title/TXOP=1 wPDG
            windex = V_row
            wPDG[windex][2] = controlname
            wPDG[i][3] = "0"
        endif
    endfor
       
End

Thanks!

ControlInfo/W=PreDefinedGroups $controlname

ControlInfo expects a "name" of the control, not a string. You need the "$" in this case.