Text to speech
Posted: Fri Jul 11, 2008 9:14 pm
I have been doing lots of HTA stuff recently......here's an ultra small text to speech wrapper for Microsoft SAM (Windows only). SAM isn't installed on Win 98 or 2000 by default (I think), but is in XP.
Save this as speech.HTA and double click it like an EXE. Then just type something in the text area and press the speak button.
Save this as speech.HTA and double click it like an EXE. Then just type something in the text area and press the speak button.
Code: Select all
<html><head><title>SAM Demo By Alan Bond</title><hta:application id="frmMain" singleInstance="yes"
showInTaskbar="yes" contextmenu="no" maximizeButton="no" minimizeButton="no" border="thin"/></head>
<SCRIPT language="VBScript">
Dim tts:Set tts = Nothing:Set tts = CreateObject("Sapi.SpVoice"):Set tts.Voice = tts.GetVoices.Item(0)
Sub Window_OnLoad:self.reSizeTo 350,348:End Sub
Sub Speak():tts.Speak SpeakText.value, 1:End Sub
</SCRIPT>
<BODY scroll="no" style="margin:0px"><INPUT type="button" value="Speak" onClick="Speak()"/>
<textarea id="SpeakText" cols="40" rows="18" >hello</textarea></BODY></HTML>