vbscriptsapipitchnarrator

Narrator Pitch on Variables in VBS


I am writing a script in VBS for when I log in I am greeted with the time. However, the XML variable for voice pitch is not functioning without text that is static. Am I missing something?

Sapi.speak "<PITCH MIDDLE = '5'/>Good Morning"

This runs at a higher pitch...

Sapi.speak minute(time)

While this is normal.

I have tried "<PITCH MIDDLE = '5'/> minute(time)", <PITCH MIDDLE = '5'/>middle(time), and "<PITCH MIDDLE = '5'/>"middle(time). All of which return with errors.

I appreciate any help that is given. :)


Solution

  • What you pass to the Speak method is a string. You are trying to pass a string and a number, so, all you should need to do is to concatenate both using the & concatenate operator to obtain a string with the full content

    Sapi.speak "<PITCH MIDDLE = '5'/>" & Minute(Time)