Console Application Input, hints needed :)

Discuss any general programming issues here
Post Reply
User avatar
Allanon
Posts: 464
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Console Application Input, hints needed :)

Post by Allanon » Tue Jan 21, 2020 11:35 am

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
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 3359
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Console Application Input, hints needed :)

Post by airsoftsoftwair » Tue Jan 21, 2020 9:55 pm

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.

User avatar
Allanon
Posts: 464
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Console Application Input, hints needed :)

Post by Allanon » Wed Jan 22, 2020 8:49 am

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.
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 3359
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Console Application Input, hints needed :)

Post by airsoftsoftwair » Mon Jan 27, 2020 9:59 pm

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...

User avatar
Allanon
Posts: 464
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Console Application Input, hints needed :)

Post by Allanon » Wed Jan 29, 2020 12:19 pm

Great! :D
Thank you for the efforts!
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

Post Reply