Record and play back keystrokes?

Is it possible for BTT to, after hitting a hot key, record keystrokes and store them so they can be played back afterwards?
I can imagine a workflow like this:
Command-R starts recording keystrokes until Command-R is pressed again.
Commend-P is playing those keystrokes back in any application you choose.

This would open up so many extra use cases for BTT.