Given a string in elisp, I'd like to simulate emacs receiving whatever keypresses are necessary to re-create that string. So given the string "Hello" emacs would act exactly the same as if I had pressed Shift+H,e,l,l,o. Note that this is not always the same thing as inserting text into the buffer -- some modes like isearch-mode listen to keypress events directly.
The reason this is necessary is because there are lots of modes and extensions that make the assumption that all input comes from the keyboard or make the assumption that any buffer/window/frame change will be associated with the keyboard input event, and a lot of the time they inspect data associated with that event. For the speech recognition mode that I work on to work seamlessly with the existing body of code, it can't just call directly into elisp to perform actions, instead it needs to tell elisp to press keys to cause those actions to happen.
I have found unread-command-events, but I'm not aware of any existing code that will translate strings to the necessary key sequences. Does something like that already exist?