07-01-2025, 11:30 PM
I'm trying to use a stripped-down version of the shell Text To Speech sub that was posted some time ago...
Sub speak (message As String)
Shell _Hide "Powershell -Command " + Chr$(34) + "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('" + message + "');" + Chr$(34)
End Sub
... and it works very well.
But I want to use it to speak the instructions for a game, which has several short paragraphs, and I want the user to be able to halt the speech after
any paragraph and return to the game. I've tried using a few variants of _Keyhit>0 and Inkey$<>"" but none seems to be recognized while the speech is in progress, presumably because I'm still in Shell. Any suggestions on how to do this (simply) would be appreciated.
Sub speak (message As String)
Shell _Hide "Powershell -Command " + Chr$(34) + "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('" + message + "');" + Chr$(34)
End Sub
... and it works very well.
But I want to use it to speak the instructions for a game, which has several short paragraphs, and I want the user to be able to halt the speech after
any paragraph and return to the game. I've tried using a few variants of _Keyhit>0 and Inkey$<>"" but none seems to be recognized while the speech is in progress, presumably because I'm still in Shell. Any suggestions on how to do this (simply) would be appreciated.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) 
Please visit my Website at: http://oldendayskids.blogspot.com/

Please visit my Website at: http://oldendayskids.blogspot.com/

