Monday, March 7, 2016

Adding Microsoft TTS Voice to HTA Applictions


HTA sub routine

Sub Speak (text) 'V3.20 'Dim objVoice 'Enabling this section will slow down the HTA program 'Set objVoice = CreateObject("SAPI.SpVoice") 'Set objVoice.Voice = objVoice.GetVoices("Name=microsoft sam").Item(0) 'objVoice.Speak Replace (text, "'d", "ed") 'objVoice.Speak text 'msgbox Text 'Running VBS script allows HTA to continue while message is played. cmdVoice = "voice.vbs " & chr(34) & text & chr(34) Objshell.run CmdVoice,0,0 End Sub Voice.vbs Script 'V3.20 on error resume next If wscript.arguments.Item(0) <> "" Then Text = wscript.arguments.Item(0) Set objVoice = CreateObject("SAPI.SpVoice") 'Set objVoice.Voice = objVoice.GetVoices("Name=microsoft sam").Item(0) 'objVoice.Speak Replace (text, "'d", "ed") objVoice.Speak Text end if

No comments:

Post a Comment