erifash Posted June 21, 2005 Share Posted June 21, 2005 Thanks to El-Trucha for making a _Talk() function. I have modified it so that instead of exporting VBScript, it uses objects (requires latest beta). I tried to make the voices change but, no luck. Here's the code (with example): _TalkOBJ('This is auto it beta speaking.') Func _TalkOBJ($s_text) Local $o_speech = ObjCreate("SAPI.SpVoice") $o_speech.Speak($s_text) $o_speech = "" EndFunc Any help with the different voices? I checked MSDN and I think I should use $o_speech.SetVoice() but when I try to, it doesn't work. I think I'm getting the syntax wrong. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
erifash Posted June 21, 2005 Author Share Posted June 21, 2005 Anyone like it? It doesn't have to write a temporary file anymore, but I still need help changing the voices. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
sykes Posted June 22, 2005 Share Posted June 22, 2005 As far as using an object to speak, this was already done back in March. Would be nice to change the voices though. There's a VBScript example of doing this in the following thread.http://www.autoitscript.com/forum/index.ph...&hl=speak&st=15 We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
datkewlguy Posted June 22, 2005 Share Posted June 22, 2005 As far as using an object to speak, this was already done back in March. Would be nice to change the voices though. There's a VBScript example of doing this in the following thread.http://www.autoitscript.com/forum/index.ph...&hl=speak&st=15<{POST_SNAPBACK}>yeah i was gonna say, i thought this was already done... Link to comment Share on other sites More sharing options...
erifash Posted June 22, 2005 Author Share Posted June 22, 2005 Ahhhh... okay then. I must have missed the post. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
erifash Posted June 22, 2005 Author Share Posted June 22, 2005 But, in the topic you directed me to, Green Lantern asks...How can you change the voice in AutoIt with COM?<{POST_SNAPBACK}>...and no one replied. So, how can you change the voice in Autoit with COM? I would be very glad if someone answered this because all I get is the "action with this object failed" error. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
w0uter Posted June 22, 2005 Share Posted June 22, 2005 from roger: ' Declaring variable to hold SAPI object. Dim voic ' Creating SAPI object using spvoice. Set voic = Wscript.CreateObject("SAPI.SpVoice") ' If you want to change the voice then uncomment any of the following 4 lines. 'Set voic.voice = voic.GetVoices("Name=Microsoft mary", "Language=409").Item(0) 'Set voic.voice = voic.GetVoices("Name=Microsoft mike", "Language=409").Item(0) 'Set voic.voice = voic.GetVoices("Name=Microsoft sam", "Language=409").Item(0) 'Set voic.voice = voic.GetVoices("Name=crystal16", "Language=409").Item(0) ' you can set other parameters and properties like voice pitch, speed etc. ' Using speak function of SpVoice to speak a string. voic.Speak("Welcome To My First Speech Enabled ASP Page, Have a nice day!") ' Destroying SAPI.spvoice object. Set voic = nothing My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
layer Posted June 22, 2005 Share Posted June 22, 2005 I've never used COM before and came out with this? It doesn't work, I get an error, try it. ;Declaring variable to hold SAPI object. Dim $voic ;Creating SAPI object using spvoice. $voic = ObjCreate("SAPI.SpVoice") ;If you want to change the voice then uncomment any of the following 4 lines. $voic.voice = $voic.GetVoices("Name=Microsoft mary", "Language=409").Item(0) ;Set voic.voice = voic.GetVoices("Name=Microsoft mike", "Language=409").Item(0) ;Set voic.voice = voic.GetVoices("Name=Microsoft sam", "Language=409").Item(0) ;Set voic.voice = voic.GetVoices("Name=crystal16", "Language=409").Item(0) ;you can set other parameters and properties like voice pitch, speed etc. ;Using speak function of SpVoice to speak a string. $voic.Speak("Welcome To My First Speech Enabled ASP Page, Have a nice day!") ;Destroying SAPI.spvoice object. $voic = "" Remeber I've never used COM before... FootbaG Link to comment Share on other sites More sharing options...
w0uter Posted June 22, 2005 Share Posted June 22, 2005 i think you need to use tokens to set it. for ex. you can use tokens to get all the voices. so i asume you should pass a token to the "set voice" func. dim $voic = ObjCreate("SAPI.SpVoice") For $Token In $Voic.GetVoices('', '') ConsoleWrite($token.GetDescription & @LF) Next $voic = "" My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
erifash Posted June 22, 2005 Author Share Posted June 22, 2005 (edited) w0uter: Exactly what msdn said about the tokens thing, except I am a COM noob and didn't understand it. layer: I tried that idea and it didn't work. I dug further into msdn and it said I need to use $o_speech.SetVoice() but when I try and do that it won't work. I might be getting the syntax wrong. EDIT: I thought it would help to give you my failed attempt. _TalkOBJ('This is auto it beta speaking.', 2) ;voice params: ; ;1 - Microsoft Sam ;2 - Microsoft Mary ;3 - Microsoft Mike ;4 - Crystal16 (if installed) Func _TalkOBJ($s_text, $s_voice = 1) Local $o_speech = ObjCreate("SAPI.SpVoice") If $s_voice = 1 Then $o_speech.voice = $o_speech.GetVoices("Name=Microsoft sam", "Language=409").Item(0) If $s_voice = 2 Then $o_speech.voice = $o_speech.GetVoices("Name=Microsoft mary", "Language=409").Item(0) If $s_voice = 3 Then $o_speech.voice = $o_speech.GetVoices("Name=Microsoft mike", "Language=409").Item(0) If $s_voice = 4 Then $o_speech.voice = $o_speech.GetVoices("Name=crystal16", "Language=409").Item(0) $o_speech.Speak($s_text) $o_speech = "" EndFunc Edited June 22, 2005 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
w0uter Posted June 22, 2005 Share Posted June 22, 2005 It seems that .Voice doesnt want to accept the Token. Try'd like 3 diff ways. Im clueless. Sven maby ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Valuater Posted November 5, 2005 Share Posted November 5, 2005 nice original scipt wish we could get the voice selection to work 8) Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 5, 2005 Share Posted November 5, 2005 Yes the voice addition would be nice. Hrm.. Sven where might you be lurking? JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
BigDod Posted November 5, 2005 Share Posted November 5, 2005 nice original sciptwish we could get the voice selection to work8)Here is something I picked up in the forums a while back$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler _TalkOBJ('This is auto it beta speaking.', 1) _TalkOBJ('This is auto it beta speaking.', 2) _TalkOBJ('This is auto it beta speaking.', 3) ;voice params: ; ;1 - Microsoft Mary ;1 - Microsoft Sam ;3 - Microsoft Mike Func _TalkOBJ($s_text, $s_voice = 3) Local $o_speech = ObjCreate ("SAPI.SpVoice") Select Case $s_voice == 1 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) Case $s_voice == 2 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) Case $s_voice == 3 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) EndSelect $o_speech.Speak ($s_text) $o_speech = "" EndFunc ;==>_TalkOBJ ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns EndfuncI have no idea who wrote it but it was not me. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
erifash Posted November 5, 2005 Author Share Posted November 5, 2005 Hmmm... It looks like it should work but it doesn't on this computer because I only have Microsoft Sam. Can anyone else test this out? My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
BigDod Posted November 5, 2005 Share Posted November 5, 2005 Hmmm... It looks like it should work but it doesn't on this computer because I only have Microsoft Sam. Can anyone else test this out?I downloaded speechsdk51 from microsoft so that i could use it. It is a 70Mb download. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 5, 2005 Share Posted November 5, 2005 I downloaded speechsdk51 from microsoft so that i could use it. It is a 70Mb download.I have yet to download and test, but here is the link to the SDK.http://msdn.microsoft.com/library/en-us/SA...tml/Welcome.aspJS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
GaryFrost Posted November 5, 2005 Share Posted November 5, 2005 (edited) Here is something I picked up in the forums a while back$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler _TalkOBJ('This is auto it beta speaking.', 1) _TalkOBJ('This is auto it beta speaking.', 2) _TalkOBJ('This is auto it beta speaking.', 3) ;voice params: ; ;1 - Microsoft Mary ;1 - Microsoft Sam ;3 - Microsoft Mike Func _TalkOBJ($s_text, $s_voice = 3) Local $o_speech = ObjCreate ("SAPI.SpVoice") Select Case $s_voice == 1 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) Case $s_voice == 2 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) Case $s_voice == 3 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) EndSelect $o_speech.Speak ($s_text) $o_speech = "" EndFunc;==>_TalkOBJ ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns EndfuncI have no idea who wrote it but it was not me. Looks like the one I did a long time ago.Edit: yep even has the same type-o in it.Gary Edited November 5, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
erifash Posted November 5, 2005 Author Share Posted November 5, 2005 Ok, I downloaded and installed SAPI 5.1 and now this function I posted earlier works: _TalkOBJ('This is auto it beta speaking.', 2) ;voice params: ; ;1 - Microsoft Sam ;2 - Microsoft Mary ;3 - Microsoft Mike ;4 - Crystal16 (if installed) Func _TalkOBJ($s_text, $s_voice = 1) Local $o_speech = ObjCreate("SAPI.SpVoice") If $s_voice = 1 Then $o_speech.voice = $o_speech.GetVoices("Name=Microsoft sam", "Language=409").Item(0) If $s_voice = 2 Then $o_speech.voice = $o_speech.GetVoices("Name=Microsoft mary", "Language=409").Item(0) If $s_voice = 3 Then $o_speech.voice = $o_speech.GetVoices("Name=Microsoft mike", "Language=409").Item(0) If $s_voice = 4 Then $o_speech.voice = $o_speech.GetVoices("Name=crystal16", "Language=409").Item(0) $o_speech.Speak($s_text) $o_speech = "" EndFunc Thanks! My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
BigDod Posted November 6, 2005 Share Posted November 6, 2005 Looks like the one I did a long time ago.Edit: yep even has the same type-o in it.GaryYou are more than welcome to the credit. I sometimes think that it would be best if people put their names at the top of their scripts so that it is easier to remember who did them. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now