Syphon
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 6/22/2006
-
Status: offline
|
sapi-voice vbs for xp(sapi 5)
Sunday, August 06, 2006 3:35 PM
( permalink)
HI This file uses the generic microsoft sam voice
dim tts
set tts = createobject("sapi.spvoice")
tts.speak "hello"
please tell me if this dosn't work
|
|
|
|
krunch
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 7/22/2005
-
Status: offline
|
RE: sapi-voice vbs for xp(sapi 5)
Thursday, August 10, 2006 4:30 AM
( permalink)
This is what I use. It will work with up to three voices. Save as HTA
<HEAD>
<TITLE>
sapi Soundboard
</TITLE>
<HTA:APPLICATION
Application ID = "Soundboard"
APPLICATIONNAME = "Soundboard"
BORDER = "Thick"
BORDERSTYLE = "Complex"
CAPTION = "Yes"
CONTEXTMENU = "no"
ICON = "avaya.ico"
INNERBORDER = "yes"
MAXIMIZEBUTTON = "no"
MINIMIZEBUTTON = "no"
NAVIGABLE = "Yes"
SCROLL = "No"
SCROLLFLAT = "Yes"
SELECTION = "No"
SHOWINTASKBAR = "Yes"
SINGLEINSTANCE = "Yes"
SYSMENU = "yes"
VERSION = "1.0"
WINDOWSTATE = "Normal"
/>
</HEAD>
<BODY STYLE="font:14pt arial; color:white; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#000080', EndColorStr='#4F94CD')">
<SCRIPT Language="VBScript">
'<!------------------------ Set Dialog Size and Position --------------------------------->
Sub StartUp()
Dim x,y
x = (window.screen.width - 400) / 2
y = (window.screen.height - 720) / 2
If x < 0 Then x = 0
If y < 0 Then y = 0
window.resizeTo 400,720
window.moveTo x,y
End Sub
StartUp
Dim SpeechVoice, oIE
Set ISpeechVoice = CreateObject("SAPI.SpVoice")
Set wshshell = CreateObject("WScript.Shell")
Sub GetVoice
Set MyForm = Document.gvoice
Set RadioButtonDialog = MyForm.Elements("SpeechVoice")
For Each RadioButton In RadioButtonDialog
If RadioButton.Checked = True Then
SpeechVoice = RadioButton.Value
Exit For
End If
Next
Set RadioButtonDialog = Nothing
End Sub 'GetVoice
'<!--#######################[ Edit Phrases Here ]###########################-->
'<!--==--==--==--==--==--==--== This is Menu one ==--==--==--==--==--==--==-->
Sub App1_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 1"
End Sub
Sub App2_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 2"
End Sub
Sub App3_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 3"
End Sub
Sub App4_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 4"
End Sub
Sub App5_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 5"
End Sub
Sub App6_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 6"
End Sub
Sub App7_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 7"
End Sub
Sub App8_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 8"
End Sub
Sub App9_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 9"
End Sub
Sub App10_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 10"
End Sub
Sub App11_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 11"
End Sub
Sub App12_onclick
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak "This is phrase 12"
End Sub
'<!--#########################[ End Edit Phrases ]##########################-->
'<!--==--==--==--==--==--==[ 8-Ball ]==--==--==--==--==--==-->
Sub EightBall
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
Dim phrase(19)
'The phrases
phrase(0) = "Signs point to yes."
phrase(1) = "Yes."
phrase(2) = "Reply hazy, try again."
phrase(3) = "Without a doubt."
phrase(4) = "My sources say no."
phrase(5) = "As I see it, yes."
phrase(6) = "You may rely on it."
phrase(7) = "Concentrate and ask again."
phrase(8) = "Outlook not so good."
phrase(9) = "It is decidedly so."
phrase(10) = "Better not tell you now."
phrase(11) = "Very doubtful."
phrase(12) = "Yes - definitely."
phrase(13) = "It is certain."
phrase(14) = "Cannot predict now."
phrase(15) = "Most likely."
phrase(16) = "Ask again later."
phrase(17) = "My reply is no."
phrase(18) = "Outlook good."
phrase(19) = "Don't count on it."
Randomize()
ISpeechVoice.Speak "The Magic Eight ball Says,,"
ISpeechVoice.Speak(phrase(Int(rnd*Int(UBound(phrase)+1))))
End Sub
'<!--==--==--==--==--==--==[ Read from File ]==--==--==--==--==--==-->
Sub OnSay()
GetVoice
sT1 = document.all("T1").Value
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak sT1
End Sub
Sub Window_Onload
ForReading = 1
strNewFile = "Phrases.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(strNewFile, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
AvailablePhrases.Add(objOption)
Loop
objFile.Close
End Sub
Sub onthefly
Selection = AvailablePhrases.Value
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
ISpeechVoice.Speak Selection
End Sub 'onthefly
Sub OpenPhrases
ShellRun = wshshell.Run ("%comspec% /c Start Notepad Phrases.txt", 0, 1)
End Sub '
'<!--==--==--==--==--==--==[ Read from Clipboard ]==--==--==--==--==--==-->
Sub Rclip
GetVoice
Set ISpeechVoice.voice = ISpeechVoice.GetVoices.Item(SpeechVoice)
Set oIE = CreateObject("InternetExplorer.Application")
oIE.navigate "about:blank"
ISpeechVoice.Speak oIE.document.parentWindow.clipboarddata.getData("text"), SPF_DEFAULT
End Sub 'Rclip
'<!---------------------------- Subroutine ShowHelp -------------------------------------->
Sub ShowHelp
HelpText = "sapi Soundboard uses the text-to-speech feature built into Windows XP." & vbCrlf & vbCrlf &_
"----------------------------------------------------------------------------------------------------------------------" & vbCrlf &_
"Select a Voice: - Use one of the three default voices." & vbCrlf &_
"Ask the 8-Ball: - Randomly say one of 20 phrases." & vbCrlf &_
"Read from Clipboard: - Read whatever text you currently have copied on your clipboard." & vbCrlf &_
"Select a Phrase: - 12 Phrases you can define by editing this HTA." & vbCrlf &_
"Enter Phrase: - Type a Phrase and say it." & vbCrlf &_
"Select a Phrase from Phrases.txt: - Dropdown list that reads each line of Phrases.txt" & vbCrlf &_
"the open button opens Phrases.txt in notepad, you have to restart the soundboard to use changes" & vbCrlf &_
"----------------------------------------------------------------------------------------------------------------------"
HelpScreen = MsgBox(HelpText, 64, "sapi Soundboard Help")
End Sub 'ShowHelp,
'<!--==--==--==--==--==--==[ Quit ]==--==--==--==--==--==-->
Sub Quit_onclick
Window.Close
End Sub
</SCRIPT>
<!------------------------ Get Voice ---------------------------------------->
<form
name="gvoice" method="get">
<font color="#00BFFF"><i><fieldset><legend>Select a Voice</legend></i></font>
 <input type="radio" checked name="SpeechVoice" value="0">Michael  
<input type="radio" name="SpeechVoice" value="1">Michele  
<input type="radio" name="SpeechVoice" value="2">MS Sam
</fieldset>
</form>
<!------------------------ Ask the 8-ball ---------------------------------------->
<p><h5>Ask the 8-Ball   <input type="button" value="8-Ball" onclick="EightBall"></h5>
<!------------------------ Read from Clipboard ---------------------------------------->
<h5>Read from Clipboard   <input type="button" value="Read" onclick="Rclip"></h5></p>
<HR>
<!------------------------ Phrase Menu Buttons - Frames ---------------------------------------->
<h5>Select a Phrase you Wish to Say:</h5>
<center>
<table width="100%" border=1>
<tr>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App1" VALUE="Phrase 1">
</td>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App2" VALUE="Phrase 2"><BR>
</td>
</tr>
<tr>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App3" VALUE="Phrase 3"><BR>
</td>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App4" VALUE="Phrase 4"><BR>
</td>
</tr>
<tr>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App5" VALUE="Phrase 5"><BR>
</td>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App6" VALUE="Phrase 6"><BR>
</td>
</tr>
<tr>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App7" VALUE="Phrase 7"><BR>
</td>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App8" VALUE="Phrase 8"><BR>
</td>
</tr>
<tr>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App9" VALUE="Phrase 9"><BR>
</td>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App10" VALUE="Phrase 10"><BR>
</td>
</tr>
<tr>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App11" VALUE="Phrase 11"><BR>
</td>
<td>
<INPUT STYLE="Height:24;Width:100%;font-Size:12;color:#-2147483640;font-weight:bold;font-family:Comic Sans MS" TYPE=button NAME="App12" VALUE="Phrase 12"><BR>
</td>
</tr>
</table>
<HR>
<!------------------------ Type in a phrase to say ------------------------------>
<form method="POST">
<p>Enter Phrase: <input type="text" name="T1" id="idT1" size="30"></p>
<p><input type="button" value="Say it" name="B1" onclick="OnSay">  <input type="reset" value="Clear" name="B2"></p>
</form>
</center>
<!------------------------ Select Phrase from Phrases.txt ------------------------------>
<CENTER>
<FONT SIZE=2><B><I>Select Phrase from Phrases.txt</I></B></FONT><BR>
<select size="1" name="AvailablePhrases"></select>
<BR>
<BR>
<input type="button" onClick="onthefly" value="Submit">
<input type="button" value="Open" onclick="OpenPhrases">
<HR>
<!------------------------ [ Quit ] ------------------------------>
<INPUT TYPE=BUTTON NAME="Quit" VALUE=" Quit ">  <input type="button" value=" Help " onclick="ShowHelp">
</CENTER>
</BODY>
<HTML>
|
|
|
|
est
-
Total Posts
:
40
- Scores: 0
-
Reward points
:
0
- Joined: 10/12/2006
-
Status: offline
|
RE: sapi-voice vbs for xp(sapi 5)
Thursday, October 12, 2006 8:04 PM
( permalink)
Start -> Run
mshta vbscript:CreateObject("SAPI.SpVoice").Speak("Hello,world!")(Window.close)
This could be used in batch programming, too.
<message edited by est on Thursday, October 12, 2006 8:06 PM>
|
|
|
|
mcds99
-
Total Posts
:
519
- Scores: 4
-
Reward points
:
0
- Joined: 2/28/2006
-
Status: offline
|
RE: sapi-voice vbs for xp(sapi 5)
Thursday, October 19, 2006 3:48 AM
( permalink)
This makes life so much more fun! Can't wait until my son wakes up in the morning to his computer talking to him. LOLROF!
Sam Keep it Simple Make it Fun KiSMiF
|
|
|
|
XiaoAiWhc
-
Total Posts
:
6
- Scores: 0
-
Reward points
:
0
- Joined: 11/10/2005
-
Status: offline
|
RE: sapi-voice vbs for xp(sapi 5)
Thursday, October 26, 2006 9:31 PM
( permalink)
it's so much more fun .But ,in my computer , it can not be read as one word spelling. why? Thanks in advance.
|
|
|
|
est
-
Total Posts
:
40
- Scores: 0
-
Reward points
:
0
- Joined: 10/12/2006
-
Status: offline
|
RE: sapi-voice vbs for xp(sapi 5)
Friday, October 27, 2006 12:15 AM
( permalink)
Do NOT program in a programmer's way
|
|
|
|