I think approaches like the following could work, too:

var inkey_result = -1;
while(inkey_result != esc code && inkey_result != enter code) inkey(my_str); // wait should not be necessary here


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends