Also note that the default value of this is 100. The accepted values are 0 –> 100 anything more or less will result in a error being displayed. It does exactly what you would think: adjusts the volume that will be used when speaking. The first property you can look at is Volume. Now that we know how to let PowerShell speak to us, lets take a look at a few things we can do to adjust settings prior to using the Speak() methods. $speak.Speak("Would you like to play a game?")ĭon’t forget call Dispose() after your final call to Speak(), otherwise you will not be able to play the WAV file. $speak.SetOutputToWaveFile("C:\users\Administrator\Desktop\test.wav") But before that, we need to add the System.Speech assembly as it is not already loaded. Lets start digging into this by creating an object using the SpeechSynthesizer class. At the end I will point you towards a small function that I created which will allow you to easily send data to PowerShell which will then be spoken to you. But I won’t be touching that in this article but instead will be looking at the class instead. This is also one of many articles that I have had on the backburner while working things that I felt were more important to post, but felt like I had better get this out before I wait much longer.īack in the day, one would have looked towards using a COM object (sapi.spvoice) to make this happen. There are quite a few examples of this floating around and this is my turn at talking about it and showing what you can do as well as showing off one of my functions. Net classes to do things such as letting PowerShell talk to us. Besides using PowerShell for the usual work related things, we can also have some fun with it by tapping into various.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |