Text-to-speech from my file/database? - c++

I've made a little alarm program that is supposed to say one of a few things. There's a similar program on macs, but I couldn't find it for Windows, so I just wrote it in C++. Right now, I'm using a text file. The format of the text file I am parsing should help you to understand how the program works:
alarmName_Wakeup //There's a prefix alarmName, so I know when one list starts and another ends.
Cock-a-doodle-doo! //One thing to say.
Get out of bed! //Another thing to say.
Hello. Would you like to buy some guava juice? //Yet another thing to say.
So, I'm basically just trying to have the alarm randomly read one of these lines of text every five minutes until the user goes to his or her computer and presses the hotkey or clicks 'Stop Alarm'. I haven't been able to figure out how to get text-to-speech from a file or a database, though. I always need to have the text pasted in notepad or something, which is really shoddy. Please, help me figure out how.

The closest I can find to what I'm looking for is Open-SAPI, which works for both Linux and Windows.

Related

I need to keep a text static, so when I run the .exe the text won't disappear (go up) no matter how much I type

First of all, I need this just for a program than runs in console only.
So, I need a specific text to always be displayed in the console, in the same place, no matter how much other text appears below it. It can't "go up", it has to be shown always.
I don't know if there's actually a way/command, to do that. So I figured I could just clear the console (clear the screen) and show it, repeating this multiple times. But I've read in several similar questions that doing so is not actually safe or the correct way to go, and I can't find an actual answer on why it isn't safe.
So I was wondering, first why clearing the console is not safe?
And most importantly how should I approach this?
Sorry if it's not well written, I'm a little rusty with my English.
If running it in windows compiler only.

Moving cursor using code and opening folder

This is a very random and maybe a bit strange question that i thought of at 3AM. I was thinking about how code could make my day to day life easier. Every morning I wake up, open chrome to the facebook conversations with my boyfriend, and write "good morning". And thats when i thought about this hypothetical project(just out of curiosity, I wouldn't use it haha): making a code that i can just run that does all of this for me.
I could have a html file that could redirect to the facebook link(https://www.facebook.com/messages/t/boyfriend_name). But how would I go on to make the code open this file, then move the mouse to where its supposed to go (the white area where the user inputs the text) then insert the text then press send?
I'm not asking for any code help as I can imagine that is too much, but my question is: could this be achievable in C++?(This is what we've been studying at school so far). If not, what coding language should I use? Is the idea achievable without a vast knowledge in computer science? If yes, have you got any sources about opening files using C++, moving cursor etc.
Note:The OS this would happen on is Windows 10
To do what you want is possible by using AutoIT and to use it from C++ you can try AutoITX for C++. With AutoIT it's possible to detect windows, move the mouse and insert text, although a web page is like a blackbox to it, so you'll have to rely on relative pixel coordinates (it might not be very robust).

Printing text in different colours in the Windows CMD

I am planning to make a console game in C++, kind of like Dwarf Fortress (although I don't know if it was coded in C++), but I have encountered a big problem.
I want to display different things in different colours on the screen at once. I also need to change something that has already been printed (so that I don't have to re-print everything and make the screen flash annoyingly, especially that I will want to make changes every second or so) and I found a way to do that with WriteConsoleOutput() and although I don't know yet exactly how to use it, I'll be reading into it soon.
As for the colours, I found a post here about some ANSI Escape things, but it
a) doesn't work, even when copying the linked code from github
b) I don't know if it'll work with attempts to over-write the console in specific places with WriteConsoleOutput()
So my request is: could someone please ELI5 to me what am I supposed to do and why, as well as present with a viable solution to this combination of two problems so that I can replicate something like this, with the possibilty of changing what the characters show.
Thanks in advance!

How to keep the terminal from scrolling

I am writing a simple program in C++ to be run in a terminal window. I would like the output text to be locked in position on the screen. Instead of each new line appearing at the bottom of the screen and pushing everything up, I would like to be able to change a line of text or some characters in a line of text, while keeping other lines above and below it static. I know I have seen this done in terminal, and I believe it was done with C++, but I can't find any documentation on it. I cannot even think of what this type of display might be called. My google fu has failed me; please help. If you can tell me what commands/library to use, that would be great, but even being able to tell me what commands accomplish this in a programming language other than C++ would give me more to go on than I have now.
You want ncurses, a library for displaying text on a terminal.
If you are programming for Microsoft Windows, try googling for Win32 Console Functions.

How to get console text to refresh rather than re-type?

Hi so i'm making a game through the console window, and i was wondering if there was any way to just get maybe one or two text character's placement to change or disappear. Usually to accomplish this i would have to tell the console to re-type every single character and line all over again, but this just takes to long (1 second fps plus .5 second time spent re-typing the scene).
Is there some way i could re-fresh or change one or two lines or 'characters' seen on the console so so much time is not spent on waiting for the console to re-typing my 24 lines, each a string? (the scene made up of text)
Thanks! =)
btw... does anyone remember that little easter egg in windows which was an entire star wars movie made out of text in the console?? I want the game be smooth like that!
You'll need to use an external library to interface with the console as C++ doesn't have these capabilities, but it is possible.
My old goto for this sort of thing is ncurses. It's straightforward, quick to set up, and cross-platform. But it's old, and its age shows. (If you're on windows you'll have to use pdcurses; same capabilities, different package).
There are also console-specific ways of doing this. In particular, Windows provides an API for performing these sorts of actions.
You need ncurses library.
See console print w/o scrolling for reasons and examples.
Also google for the source to the rogue/urogue/nethack games which do that already.