You're welcome. This demonstrates it. _DELAY requires QB64, otherwise you could use a TIMER loop.
DIM k AS STRING
PRINT "Type something in the next 5 seconds."
' uncomment the next line to clear the buffer.
' WHILE LEN(INKEY$): WEND
PRINT "Press ESC to exit."
k = INKEY$
IF LEN(k) THEN PRINT k;
LOOP UNTIL k = CHR$(&H1B) ' esc key