Vivvic Posted November 15, 2006 Posted November 15, 2006 Not sure why GUI wont change the variable expandcollapse popup#include <GuiConstants.au3> GuiCreate("Text to mp3", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $IB = GuiCtrlCreateEdit("Input text here", 20, 10, 350, 260) $Done = GuiCtrlCreateButton("Done", 100, 280, 160, 30) $text = GUICtrlRead($ib) ;$text = "1 freedom of speech:2 bear arms:3 quartering of troops:4 search and siesure:5 plea the fifth/double jepordy:6 trial:7 trial by jury:8 cruel punishment:9 right for people:10 state rights:11 suits aginst states:12 president/vice president:13 slavery:14 equal treatment:15 all men vote:16 direct tax:17 direct election:18 prohibition:19 women vote:20 lame duck:21 end prohibation:22 terms of president:23 D.C. electors:24 poll tax:25 president disability:26 voteing age from 21 to 18:27 congresses pay" $mp3file = @scriptdir&"\amendments.mp3" GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Done _text2mp3($text,$mp3file,"Microsoft Mike") SoundPlay ($mp3file,true) EndSelect WEnd Exit ; func _text2mp3($text,$mp3file,$myvoice="",$lameoptions="") $lameexe = @scriptdir&"\lame.exe" $tempwav = @tempdir & "\" & random(1000,9999) & ".wav" $SSFMCreateForWrite = 3 $objVOICE = ObjCreate("SAPI.SpVoice") $objFSTRM = ObjCreate("SAPI.SpFileStream") $objVTOKN = ObjCreate("SAPI.ISpeechObjectToken") if $myvoice <> "" Then dim $aVoices[1] $vIndex = -1 $sVoices = "" For $objVTOKN In $objVOICE.GetVoices() $vIndex += 1 redim $aVoices[$vIndex+1] $aVoices[$vIndex] = $objVTOKN.GetDescription() $sVoices &= @crlf & " " & $objVTOKN.GetDescription() Next $noVoice = True for $i = 0 to Ubound($aVoices)-1 if stringinstr($aVoices[$i],$myvoice) Then $objVOICE.Voice = $objVOICE.GetVoices().Item($i) $noVoice = False ExitLoop EndIf Next if $novoice Then $errmsg = "The following voices are installed on your system:"&@crlf &$sVoices $errmsg &= @crlf & @crlf & "Continuing with the default SAPI voice." msgbox(16,'Cannot find voice "'&$myvoice&'"',$errmsg) EndIf EndIf consolewrite("Speaking to WAV file..."&@crlf) $objFSTRM.Open($tempwav , $SSFMCreateForWrite, False) $objVOICE.AudioOutputStream = $objFSTRM $objVOICE.Speak($text) $objFSTRM.Close $objFSTRM = 0 $objVOICE = 0 consolewrite("Encoding WAV file to MP3..."&@crlf) $return = runwait('"'&$lameexe&'" '&$lameoptions&' "'&$tempwav&'" "'&$mp3file&'"',@scriptdir, @SW_HIDE) consolewrite("Lame.exe exit code: "&$return & @crlf) filedelete($tempwav) return $return EndFunc [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]
mikehunt114 Posted November 15, 2006 Posted November 15, 2006 Uh huh....what variable/problem? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Vivvic Posted November 15, 2006 Author Posted November 15, 2006 (edited) Ok sorry, I was speaking of $text, even after you change the text in the gui it says input text here in the audio file. ( origonal script from http://www.autoitscript.com/forum/index.ph...p;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 ) Edited November 15, 2006 by Vivvic [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]
Somniis Posted November 15, 2006 Posted November 15, 2006 Ok sorry, I was speaking of $text, even after you change the text in the gui it says input text here in the audio file. ( origonal script from http://www.autoitscript.com/forum/index.ph...p;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 )://http://www.autoitscript.com/forum/i...;hl=text++mp3 ) That's because you set $IB to the text "Input text here" and then read straight from that with GUICtrlRead(). Instead of setting $text at the beginning, put $text in the loop. While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Done $text = GUICtrlRead($IB) _text2mp3($text,$mp3file,"Microsoft Mike") SoundPlay ($mp3file,true) EndSelect WEnd
Vivvic Posted November 15, 2006 Author Posted November 15, 2006 Thank you ^^ I'm sure I will use this info in the future as well. [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]
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