Close, but not quite! I think the function you're after is res_data_get_titles. I think it returns the whole line, so to get the individual components you'd have to split the string up using str_token.
I do not know how to use it. I went through the example but I have problems with function arguments. How to find "register" where the title string is stored? The function takes "location" and "register type" where to find those inputs?
The first line loads the selected result into a register (which always seems to be 0...).
The second line creates the title. Those are variables, and they correspond to what's defined in the Title Editor (under Display Attributes) - usually just the defaults. i.e.:
Plot Type: Loadcase Name, Subcase Name, Primary Result Name, Secondary Result Name, Component (Derivation), Layer Name