Try working with this for starters:
channelBox -q -selectedMainAttributes mainChannelBox;
That will return a list of strings based on what you have selected in the top part of the channel box. The channel box in the main UI is called "mainChannelBox", which I found by doing a massive search through all of the MEL scripts used to generate the UI (located inside the main Maya application directory).
You can look up channelBox
in the MEL reference to learn more on what you can do with it.