The Friday AI is a project that I am working on for myself to help with things on my computer. I started this project to see what I can do with coding and console based applications and having them control different parts of my computer by just saying something. The commands are limited to preset commands that I type out and if these commands are not said or pronounced correctly it won't be recognized. I am working on making it recognize any speech.

# hey
class FridaySpeech    {        static SpeechRecognitionEngine recognitionEngine = new SpeechRecognitionEngine();        static SpeechSynthesizer synth = new SpeechSynthesizer();        public static Choices commands = new Choices();        public static Choices words = new Choices();        [DllImport("user32.dll")]        static extern IntPtr GetForegroundWindow();        [DllImport("user32.dll")]        static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);        string GetActiveWindowTitle()        {            const int nChars = 256;            StringBuilder Buff             IntPtr handle = GetForegroundWindow();            if (GetWindowText(handle, Buff, nChars)            {                return Buff.ToString();            }            return null;        }        public static void Start()        {            try            {                commands.Add(new string[] { "hello", "my name","search for", , "close",,,,,,"exit" });                commands.Add(new string[] { "what", , , , , , , , , , , , , , , "how","how's", "who" ,"hey",,,,,,"discord"});                //foreach(string thing in Program)                //{                //}                synth.SetOutputToDefaultAudioDevice();                GrammarBuilder gBuilder = new GrammarBuilder();                gBuilder.Append(commands);                gBuilder.AppendWildcard();                //gBuilder.Append(words);                gBuilder.AppendDictation();                Grammar grammar                 recognitionEngine.LoadGrammarAsync(grammar);                recognitionEngine.SetInputToDefaultAudioDevice();                recognitionEngine.SpeechRecognized                Console.Write("Voice Status: ");                Program.TypeWriter("Operational", ConsoleColor.Green);                Console.WriteLine();                return;            }            catch (Exception e)            {                Console.Write("Voice Status: ");                Program.TypeWriter(e.Message, ConsoleColor.Red);                Console.WriteLine();                return;            }        }        public static void Stop()        {            recognitionEngine.RecognizeAsyncStop();            Program.Messages();        }        ///<summary>        ///<para>line1</para>        ///<para>line2</para>        ///</summary>        public static void Begin()        {            try            {                Discord.MainAsync().GetResult();                string mUppercasefirst(Variables.Bot_Greetings[Program.PickIndex(Variables.Bot_Greetings)]);                Program.SendMessage(m                synth.SpeakAsync(m                //Program.SendMessage(,"");                recognitionEngine.RecognizeAsync(RecognizeMode.Multiple);                //there are two voices for windows                //Program.SendMessage(" Name:          " + synth.Voice.Name,"");                //Program.SendMessage(" Culture:       " + synth.Voice.Culture, "");                //Program.SendMessage(" Age:           " + synth.Voice.Age, "");                //Program.SendMessage(" Gender:        " + synth.Voice.Gender, "");                //Program.SendMessage(" Description:   " + synth.Voice.Description, "");                //Program.SendMessage(" ID:            " + synth.Voice.Id, "");                //Program.SendMessage(" Others:        " + synth.GetInstalledVoices(),"");                Program.SendMessage("I can hear you now.", "");                synth.SpeakAsync("I can hear you now");                Program.Messages();            }catch(Exception e)            {                Program.TypeWriter("Error: ", ConsoleColor.Red);                Console.Write(e.Message);                Console.WriteLine();                Program.SendMessage("I am not able to hear you. Check your input and output devices.", "");                Program.Messages();            }        }        static void recognitionEngine_SpeechRecognition(object sender, SpeechRecognizedEventArgs e)        {            Console.Write("Confidence: "            Console.WriteLine();            if(e.Result.Confidence            {                //if (e.Result.Text.Contains("friday"))                //{                if (e.Result.Text.Contains("thank you"))                {                    Program.SendMessage("You are welcome, Brett.", "thank you friday");                }else                if(e.Result.Text                {                    Program.SendMessage("Yes Brett?", "friday");                }else                if(e.Result.Text.Contains("quit"                {                    synth.Speak("Closing");                    Program.TypeWriter("Closing....", ConsoleColor.Yellow, ConsoleColor.White, 10);                    synth.Dispose();                    Discord.discord.ClearPresence();                    Discord.discord.Dispose();                    recognitionEngine.RecognizeAsyncStop();                    Environment.Exit(0);                }else                if(e.Result.Text.Contains("what is the date"))                {                    synth.SpeakAsync("Today's date is "                    Program.SendMessage("Today's date is "                                    }else                if(e.Result.Text.Contains("open chrome"))                {                    synth.SpeakAsync("opening google chrome");                    Process.Start("Chrome.exe", "google.ca");                    Program.SendMessage("Opening Google Chrome","open chrome");                }                /*else                {                    string m = Program.Uppercasefirst(Variables.Bot_TryAgain[Program.PickIndex(Variables.Bot_TryAgain)]);                    synth.SpeakAsync(m);                    Program.TypeWriter(m);                    Console.WriteLine();                }*/                bool found = false;                foreach (string time in Variables.Synonyms.WhatTime)                {                    if (e.Result.Text.Contains(time.ToLower()))                    {                        synth.SpeakAsync("The time is "                        Program.SendMessage("The time is "                        found                        break;                    }                }                foreach(string trigger in Variables.Synonyms.Triggers)                {                    if (e.Result.Text.Contains(trigger.ToLower()))                    {                        string messageUppercasefirst(Variables.Bot_Greetings[Program.PickIndex(Variables.Bot_Greetings)]);                        Program.SendMessage(message, trigger);                        synth.SpeakAsync(message);                        found                        break;                    }                }                if                {                    string mUppercasefirst(Variables.Bot_TryAgain[Program.PickIndex(Variables.Bot_TryAgain)]);                    synth.SpeakAsync(m);                    Program.TypeWriter(m);                    Console.WriteLine();                }                //}                /*switch (e.Result.Text)                {                    case "help":                        Program.TypeWriter(commands.ToString());                        Console.WriteLine();                        break;                    case "search for":                        Process.Start("Chrome.exe", "www.brettanda.ca");                        break;                    case "what's my name":                        Program.SendMessage("Your name is Brett", "what's my name");                        break;                    case "what's your name":                        Program.SendMessage("My name is Friday", "what's your name");                        break;                    case "what time is it":                        Program.SendMessage("The time is " + string.Format("{0:h:mm:ss tt}", DateTime.Now), "what time is it");                        break;                }*/            }            else            {                Program.TypeWriter(Program.Uppercasefirst(Variables.Bot_TryAgain[Program.PickIndex(Variables.Bot_TryAgain)]));                synth.SpeakAsync(  Program.Uppercasefirst(Variables.Bot_TryAgain[Program.PickIndex(Variables.Bot_TryAgain)]));            }        }        public static void Loops()        {        }        public static Boolean isCommand(string message)        {            string prefix = "friday";            if (message.ToLower().Contains(prefix                return true;            }            else            {                return false;            }        }    }