QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: hanness on September 16, 2021, 03:17:37 pm

Title: Is there a way to have Inkey$ function when QB64 program uses a console window?
Post by: hanness on September 16, 2021, 03:17:37 pm
I'm working on a QB64 program that uses only a console Window but it appears that Inkey$ does not function in a console window. Is there any trick that I can use to make this work?
Title: Re: Is there a way to have Inkey$ function when QB64 program uses a console window?
Post by: SMcNeill on September 16, 2021, 03:32:37 pm
What you want is _CONSOLEINPUT and _CINP which is used much like the _DEVICES statement — the one command operates for keyboard and mouse input both.
Title: Re: Is there a way to have Inkey$ function when QB64 program uses a console window?
Post by: hanness on September 16, 2021, 05:54:50 pm
Thanks. That really helped me a lot.

I have a program using the console that has the ability to play back a script by simply dropping responses into the keyboard buffer.

To pause execution after some messages being displayed to the user I was running a

shell "pause"

With the script, I wanted to just effectively press ENTER when a pause command was run since we don't want pauses in the program when responses are scripted. The problem with this was that the QB64 keyboard buffer has no effect on the pause command run from shell, so execution would halt completely. Thanks to the info you provided I was able to resolve that issue and my scripts now run great.