I have just tried this script that I have made based on yours and I could retrieve the radius value from the selected sphere which is considered good to me.
private void RunScript(bool x, ref object A)
{
Rhino.DocObjects.ObjRef objref;
if(x == true)
{
const ObjectType filter = Rhino.DocObjects.ObjectType.Brep;
Rhino.Commands.Result objRef = Rhino.Input.RhinoGet.GetOneObject("Select curve to divide", false, filter, out objref);
objref.Object().Attributes.SetUserString("radius", "20.0");
objref.Object().CommitChanges();
A = objref.Object().Attributes.GetUserString("radius");
}
Now I want to show that in the properties list in Rhino viewport when I select the sphere. Do you have an idea on how to axis this properties list and change it ?.