For the categories you need to get the reference to your desired FSM (or iterate through all available FSMs by using Fsm.FsmList or Fsm.SortedFsmList). Of course you also need the PlayMaker using directive: using HutongGames.PlayMaker;
and from there on you can get all variables and in there all categories, like so:
yourFSM.Variables.Categories
This holds an array of all categories in that FSM (the first entry is empty, because it's the default category where all unsorted variables land), which you can get or set (though I couldn't find how to set the category of single fsm-variables).
For reference, here is how I get a list of all categories from a specific FSM in my own debug window:
string[] allCategories = activeFSM.Variables.Categories;
for(int i = 0; i < allCategories.Length; i++)
{
//skip empty categories to only display relevant ones
if(allCategories[i] == "" || allCategories[i] == null)
{
continue;
}
GUILayout.Label("Category " + i + ": " + allCategories[i]);
}
Unfortunately, I also couldn't figure out how to get the used-count of each variable and I think it only gets calculated inside the PlayMaker Editor window script or somewhere else, but I might be wrong. There could be something in other directives like HutongGames.Utility or a helper function nested inside Fsm.[...], but I haven't found anything related yet.