Hi!
I was trying to familiarize myself with Gambas, so I'm in the process of porting some older console programs of other langs to Gambas.
I now have these questions:
1) What about some putting some color at program's console output.
I think, since at console there's no GUI, a colored text is an effective way to attract user's attention to something important.
Maybe ncurses is the answer to the above question?
2) What about sound output?
Nothing complicated. A single console's beep - notification, is enough for me.
I think it's complimentary to colored text (for attracting attention).
3) What about, some more advanced keyboard control?
Maybe something like the old GW commands Inkey or On Key (for setting a global shortcut)?
I already read the related forum post viewtopic.php?p=736#p736.
Maybe ncurses is a different approach to the same problem.
TIA!
Console qustions.
Console qustions.
For the glorious men, every land is a grave.
Thucydides "Pericles Funeral Oration".
Thucydides "Pericles Funeral Oration".
Re: Console qustions.
My answer is relevant to your question about sound in Gambas.
I suggest you this specific and wide section of the wiki of Italian forum:
https://www.gambas-it.org/wiki/index.ph ... file_audio
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
- Quincunxian
- Posts: 173
- Joined: Sunday 25th June 2017 12:14am
- Location: Western Australia
Re: Console qustions.
Hi Giorgos
Sound
Try this ALSA based command - it will need a bit of tweeking but it made some noise from my command line.
$( speaker-test -t sine -f 1000 )& pid=$! ; sleep 2.0s ; kill -9
Found the above solution Here at StackExchange.
Colour
I 'sort of ' remember doing something this back in my old Dos days when writing Autoexec.bat menu commands.
echo -e "\e[1;31m This is red text \e[0m"
Found this solution ( and a lot of other command line stuff) Here at O'Reilly.com
Sound
Try this ALSA based command - it will need a bit of tweeking but it made some noise from my command line.
$( speaker-test -t sine -f 1000 )& pid=$! ; sleep 2.0s ; kill -9
Found the above solution Here at StackExchange.
Colour
I 'sort of ' remember doing something this back in my old Dos days when writing Autoexec.bat menu commands.
echo -e "\e[1;31m This is red text \e[0m"
Found this solution ( and a lot of other command line stuff) Here at O'Reilly.com
Cheers - Quin.
I code therefore I am
I code therefore I am
Re: Console qustions.
THANKS guys!!!
I'll try them.
I'll try them.
For the glorious men, every land is a grave.
Thucydides "Pericles Funeral Oration".
Thucydides "Pericles Funeral Oration".
- Technopeasant
- Posts: 144
- Joined: Saturday 13th July 2019 6:50pm
- Location: Stony Plain, Alberta, Canada
- Contact:
Re: Console qustions.
For reference, you can also get it to beep using ncurses.
Screen.Beep
As for colour, it can be done rather simply.
Window.Print("String ", X, Y, Attr.Normal, Pair[Color.Red, Color.Green])
Where the first of the pair is foreground and the second is background.
The whole window can be done using the foreground and background properties.
Window.Background = Color.Bue
I have also generated noise with this command.
Exec ["play", "-n", "synth", "1", "sine", Rnd(1, 500)]
Screen.Beep
As for colour, it can be done rather simply.
Window.Print("String ", X, Y, Attr.Normal, Pair[Color.Red, Color.Green])
Where the first of the pair is foreground and the second is background.
The whole window can be done using the foreground and background properties.
Window.Background = Color.Bue
I have also generated noise with this command.
Exec ["play", "-n", "synth", "1", "sine", Rnd(1, 500)]