Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Text-to-speech script


  • Please log in to reply
19 replies to this topic
ebpdoug
  • Members
  • 24 posts
  • Last active: Oct 19 2013 09:50 PM
  • Joined: 28 Oct 2009
I should have mentioned: running the script using WSCRIPT instead of CSCRIPT will prevent a command window from popping up.

Kissa
  • Guests
  • Last active:
  • Joined: --
Just put it in a ahk
gui add, button, talk, Talk
Gui, Add, Text,, Text:
Gui, Add, Edit, vSay
gui show
return

buttonTalk:
Gui, Submit
gui show
   FileDelete, %A_ScriptDir%\SpeechMe.vbs
   FileAppend, Dim voic `n, %A_ScriptDir%\SpeechMe.vbs
   FileAppend, Set voic = WScript.CreateObject("SAPI.SpVoice")`n, %A_ScriptDir%\SpeechMe.vbs
   FileAppend, Set voic.voice = voic.GetVoices("", "Language=809").Item(0)`n, %A_ScriptDir%\SpeechMe.vbs
   FileAppend, voic.Speak("%Say%")`n, %A_ScriptDir%\SpeechMe.vbs
   FileAppend, Set voic = nothing`n, %A_ScriptDir%\SpeechMe.vbs
   Run, WSCRIPT.EXE "%A_ScriptDir%\SpeechMe.vbs",,, WSCRIPT_PID
return

GuiClose:
ExitApp
:wink: :wink:

fate alexander
  • Guests
  • Last active:
  • Joined: --
i got a a question
isn't there different types of voices for the computer orrr.. am i wrong

komok
  • Guests
  • Last active:
  • Joined: --

I keep getting a confirm message about allowing IE to use my clipboard. Any way around this?

Try my script. It should be named speak.vbs. Any comments are welcome.
'The speak.vbs script says aloud the text from the clipboard using the installed in system voice engine. By [email protected]
Dim strComputer, strProcessKill, strText, strLocalTime, strMaxLocalTime 
Dim objWMIService, objProcess, colToKill, objVoice, objHTML 
strComputer = "."
'check whether the script is already running 
strProcessKill = "speak.vbs"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" _ 
& strComputer & "\root\cimv2") 
Set colToKill = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE CommandLine LIKE '%" & strProcessKill & "%'")  
If colToKill.Count > 1 Then
strMaxLocalTime=""
For Each objProcess In colToKill
strLocalTime=Left(objProcess.CreationDate,14)
If strLocalTime > strMaxLocalTime Then 
strMaxLocalTime = strLocalTime
End If
Next
For Each objProcess In colToKill
strLocalTime=Left(objProcess.CreationDate,14)
If strLocalTime <> strMaxLocalTime Then 
objProcess.Terminate()
End If
Next 
End If
'then speak the text
Set objVoice = CreateObject("Sapi.SpVoice")
Set objHTML = CreateObject("htmlfile")
strText = objHTML.ParentWindow.ClipboardData.GetData("text")
If strText <> "" Then
objVoice.speak strText
End If


poetbox
  • Members
  • 113 posts
  • Last active: Sep 11 2013 08:05 AM
  • Joined: 07 Jan 2007

I keep getting a confirm message about allowing IE to use my clipboard. Any way around this?

Try my script. It should be named speak.vbs. Any comments are welcome.
'The speak.vbs script says aloud the text from the clipboard using the installed in system voice engine. By [email protected]
Dim strComputer, strProcessKill, strText, strLocalTime, strMaxLocalTime 
Dim objWMIService, objProcess, colToKill, objVoice, objHTML 
strComputer = "."
'check whether the script is already running 
strProcessKill = "speak.vbs"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" _ 
& strComputer & "\root\cimv2") 
Set colToKill = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE CommandLine LIKE '%" & strProcessKill & "%'")  
If colToKill.Count > 1 Then
strMaxLocalTime=""
For Each objProcess In colToKill
strLocalTime=Left(objProcess.CreationDate,14)
If strLocalTime > strMaxLocalTime Then 
strMaxLocalTime = strLocalTime
End If
Next
For Each objProcess In colToKill
strLocalTime=Left(objProcess.CreationDate,14)
If strLocalTime <> strMaxLocalTime Then 
objProcess.Terminate()
End If
Next 
End If
'then speak the text
Set objVoice = CreateObject("Sapi.SpVoice")
Set objHTML = CreateObject("htmlfile")
strText = objHTML.ParentWindow.ClipboardData.GetData("text")
If strText <> "" Then
objVoice.speak strText
End If

as I know ,AHK can do it directly instead of vbs.