help with Macro: apply last selected font

Hello,

I'm wondering if it is possible and if anyone could assist with help writing a macro that would apply last selected font (the one at the top of 'X last used' fonts in the fonts select toolbar) to the currently selected text? I'm aware you can write a macro applying a specific font to selected text and I'd like to make a similar, but more universal, one.

thank you