! i cannt find selected Attribute!

hi all...
this is very important .. how can i know which attribute is selected,
if I am not clear enough, i'll explain more :

you know when we select object and then we select (tx)

firas

so you want to query the channelBox.

//************************************************
string $chanBoxName = "mainChannelBox";

    string $chObjects[] = `channelBox -q -mol $chanBoxName`;
    string $chShapes[]  = `channelBox -q -sol $chanBoxName`;
    string $chHistory[] = `channelBox -q -hol $chanBoxName`;
    string $chOutput[]  = `channelBox -q -ool $chanBoxName`;
    string $slMain[]    = `channelBox -q -sma $chanBoxName`;
    string $slShapes[]  = `channelBox -q -ssa $chanBoxName`;
    string $slHistory[] = `channelBox -q -sha $chanBoxName`;
    string $slOutput[]  = `channelBox -q -soa $chanBoxName`;

    print ("***************************n");
    print ("OBJECTS:n");
    print $chObjects;
    print ("---------------------------n");
    print ("SHAPES:n");
    print $chShapes;
    print ("---------------------------n");
    print ("HISTORY:n");
    print $chHistory;
    print ("---------------------------n");
    print ("OUTPUT:n");
    print $chOutput;
    print ("---------------------------n");
    print ("MAINATTRS:n");
    print $slMain;
    print ("---------------------------n");
    print ("SHAPEATTRS:n");
    print $slShapes;
    print ("---------------------------n");
    print ("HISTORYATTRS:n");
    print $slHistory;
    print ("---------------------------n");
    print ("OUTPUTATTRS:n");
    print $slOutput;
    print ("***************************n");

//************************************************

hope this helps