coffeeturtle Posted April 27, 2011 Share Posted April 27, 2011 I'm sorry, but I can really use some help. I want to convert this MSDN VB code which does what I need into autoit. I want to list all of the installed voices (e.g. Microsoft Sam, etc.) and then have the user choose which one he wants to use with a larger application I am working on in autoit. Thank you for any help. Here is the VB code: expandcollapse popupThe Form_Load procedure creates a voice object and displays the names of all available voices in the list box. Select a voice name in the list box and then click Command1. The Command1 procedure sets the voice object's Voice property to the selected name and causes the voice to speak its new name. Option Explicit Private V As SpeechLib.SpVoice Private T As SpeechLib.ISpeechObjectToken Private Sub Command1_Click() On Error GoTo EH If List1.ListIndex > -1 Then ' Set voice object to voice name selected in ' list box (new voice speaks its own name): Set V.Voice = V.GetVoices().Item(List1.ListIndex) V.Speak V.Voice.GetDescription Else MsgBox "Please select a voice from the list box." End If EH: If Err.Number Then ShowErrMsg End Sub Private Sub Form_Load() On Error GoTo EH Dim strVoice As String Set V = New SpVoice 'Get each token in the collection returned by GetVoices For Each T In V.GetVoices strVoice = T.GetDescription 'The token's name List1.AddItem strVoice 'Add to listbox Next EH: If Err.Number Then ShowErrMsg End Sub Private Sub ShowErrMsg() ' Declare identifiers: Dim T As String T = "Desc: " & Err.Description & vbNewLine T = T & "Err #: " & Err.Number MsgBox T, vbExclamation, "Run-Time Error" End End Sub Thank you again. Link to comment Share on other sites More sharing options...
JScript Posted April 27, 2011 Share Posted April 27, 2011 Same as: http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
monoscout999 Posted April 27, 2011 Share Posted April 27, 2011 Same as: @coffeeturtle don´t do spam...BTW... i don´t look to much your VB library but check it this.. maybe is what you want Link to comment Share on other sites More sharing options...
ProgAndy Posted April 27, 2011 Share Posted April 27, 2011 This shuold help, too: *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
coffeeturtle Posted April 27, 2011 Author Share Posted April 27, 2011 @coffeeturtle don´t do spam...BTW... i don´t look to much your VB library but check it this.. maybe is what you want Sorry, it was a mistake on my part. When I posted the first time my browser simply reloaded a the same page but this time without my text. So I thought it didn't save, and re-typed the whole thing. I just now saw the double posting.I have posts in both, so I am going to try to see which solution works and then try to close the superfluous posting. Thanks. Link to comment Share on other sites More sharing options...
coffeeturtle Posted April 27, 2011 Author Share Posted April 27, 2011 This shuold help, too: ProgAndy, you wrote some incredible stuff there! Wow! I'm afraid my little engine doesn't do as much, but I hope you don't mind if I borrow some of your ideas.On first glance, it seemed you hard-coded "Microsoft Sam"? Link to comment Share on other sites More sharing options...
jvanegmond Posted April 27, 2011 Share Posted April 27, 2011 On first glance, it seemed you hard-coded "Microsoft Sam"?Yes, he hard coded Microsoft Sam as the default option. github.com/jvanegmond Link to comment Share on other sites More sharing options...
coffeeturtle Posted April 27, 2011 Author Share Posted April 27, 2011 Yes, he hard coded Microsoft Sam as the default option.Thanks. I need a "picker" probably through a combobox or list... That is the critical step and the only reason I wanted to poll the machine for all installed voices. Windows7 uses Microsoft Anna as the default. If you don't specify a voice, Windows will automatically choose whatever default voice you have installed. The people I am coding for use a few voices and need the ability to choose for different events, etc. Link to comment Share on other sites More sharing options...
ProgAndy Posted April 27, 2011 Share Posted April 27, 2011 I just translated the VB example. It would have been better to use GUICtrlSetData($list,$x ,$Voice.Voice.GetDescription()) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
jvanegmond Posted April 27, 2011 Share Posted April 27, 2011 Thanks. I need a "picker" probably through a combobox or list... That is the critical step and the only reason I wanted to poll the machine for all installed voices. Windows7 uses Microsoft Anna as the default. If you don't specify a voice, Windows will automatically choose whatever default voice you have installed. The people I am coding for use a few voices and need the ability to choose for different events, etc.Please just run the example. I am crying inside by your statement. github.com/jvanegmond Link to comment Share on other sites More sharing options...
coffeeturtle Posted April 27, 2011 Author Share Posted April 27, 2011 Please just run the example. I am crying inside by your statement.Please don't cry. I am definitely going to try out your script. The code looks great. I'll get back to you soon about it. Thank you for helping me. Link to comment Share on other sites More sharing options...
coffeeturtle Posted May 6, 2011 Author Share Posted May 6, 2011 @coffeeturtle don´t do spam...BTW... i don´t look to much your VB library but check it this.. maybe is what you want /?do=embed' frameborder='0' data-embedContent>Thank you also monoscout999! That information you linked has helped me as well.Thank you all! 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