Page 1 of 1

Console Application Input, hints needed :)

Posted: Tue Jan 21, 2020 11:35 am
by Allanon
Hello guys,
I'm writing a console application that will run mostly on Linux shell, I've already implemented a nice library to handle escape sequences for colored text, cursor movements, message boxes, menu, etc... that I will publish when it will be completed.

I'm having a hard time to find a way to wait for a single character without the need to hit the enter key, which is required by the DebugPrompt()/ConsolePrompt() commands.

I've implemented a GridView and hitting enter after every command is very annoying (for example to scroll down the list line by line).
InKeyStr() can't ne used because Hollywood display is closed, this is a console app :)

Any tips? I'm missing something?
I've thought about opening for input the stdin, but I'm quiet a Linux newby so every hint in that direction is really appreciated :D

Re: Console Application Input, hints needed :)

Posted: Tue Jan 21, 2020 9:55 pm
by airsoftsoftwair
That's probably not possible at the moment but could be added quite easily if you need it. Manually opening stdin won't work because OpenFile() doesn't support that... the only trick I can think of is starting a shell script which does it and then passes the result back to Hollywood via a temporary file but that's really awkward.

Re: Console Application Input, hints needed :)

Posted: Wed Jan 22, 2020 8:49 am
by Allanon
Thank you Andreas for the answer,
well, I'll live with it for now, using a temporary file with another shell doesn't seem a solid way to achieve it.

If you are going to implement this function it could be handy for other people too who want to develop console applications :)
If it's possible an idea could be to add optional parameters to the ConsoleInput/DebugInput like InKeyStr, with type, maxlen and password arguments.

Re: Console Application Input, hints needed :)

Posted: Mon Jan 27, 2020 9:59 pm
by airsoftsoftwair
Allanon wrote: Wed Jan 22, 2020 8:49 am If you are going to implement this function it could be handy for other people too who want to develop console applications :)
If it's possible an idea could be to add optional parameters to the ConsoleInput/DebugInput like InKeyStr, with type, maxlen and password arguments.
Yes, but I think I'll also add some special constants for OpenFile() that allow you to directly open stdin, stdout and stderr. Could be quite useful for several purposes...

Re: Console Application Input, hints needed :)

Posted: Wed Jan 29, 2020 12:19 pm
by Allanon
Great! :D
Thank you for the efforts!

Re: Console Application Input, hints needed :)

Posted: Sat Aug 22, 2020 3:26 pm
by airsoftsoftwair

Code: Select all

- New: OpenFile() also accepts the special constants #STDIN, #STDOUT, and #STDERR now to open a program's
  standard input/output/error streams; this can be useful for advanced users