VB Script - Play Sound or Verbal Prompt

VB Script - Play Sound or Verbal Prompt

It's possible to play a sound (Wave File) or use TTS (Text to Speech) to give user and audible cue during program execution.

VB Script example:

  1. Set oVoice = CreateObject("SAPI.SpVoice")
  2. with oVoice
  3.        Set .voice = .getvoices.item(0)
  4.        .Volume = 100
  5.        .Rate = 1
  6.    end with
  7. set oSpFileStream = CreateObject("SAPI.SpFileStream")
  8. oSpFileStream.Open "c:\Windows\Media\notify.wav"
  9. oVoice.SpeakStream oSpFileStream
  10. oSpFileStream.Close
  11. oVoice.Speak "Finished Playing wave file."