#include <Sound.au3>
$input = InputBox("Que dire?","Indiquez un texte à lire")
if @error then exit
$input = StringReplace($input,"?","%3F")
InetGet("http://translate.google.com/translate_tts?ie=UTF-8&tl=fr&q=" & $input,@TempDir & "\temp.mp3",1)
$sound = _SoundOpen(@TempDir & "\temp.mp3")
_SoundPlay($sound,1)
_SoundClose($sound)
Par contre pour la ponctuation, les caractères spéciaux genre : "ç" ne fonctionne pas.
Les longues phrases non plus ne fonctionne pas et j'arrive pas a savoir combien il y a de caractère maximum.
Si quelqu'un trouve la solution je suis preneur
Les longues phrases non plus ne fonctionne pas et j'arrive pas a savoir combien il y a de caractère maximum.
Si quelqu'un trouve la solution je suis preneur
Exactement 98 caractères ( donc espaces ,virgules ect inclus )
« En mathématiques, “évident” est le mot le plus dangereux. »
Après avoir eu besoin de "Google Speech", un problème c'est poser !
Celui de ne pas pouvoir lire une long chaîne de caractères,
Donc voila l'amélioration du script, qui permet maintenant de pouvoir lire une long chaîne de caractères !
Ce code a était fait avec l'aide de Uranium qui a compter pour nous le nombre de caractères maximal et le code de Iste qui a permis la lecture de caractères spéciale, En oubliant pas le Créateur ethneldryt.
Merci a eux !!
#include <Sound.au3>
Global $END = 0,$sText,$sText1,$N = 1
$input = InputBox("Que dire?","Indiquez un texte à lire","")
If @error Then MsgBox(0,"",$input&" "&GUICtrlRead($input))
$TesteEs = StringReplace($input," ","")
If $TesteEs <> "" Then
$NCharac = _CountString($input) ; ~ On peut trés bien utiliser la fonction StringLen().
While $END <> $NCharac
$sText1 = StringMid($input,$N,98)
If $sText1 <> "" Then _GSpeech($sText1)
$N += 98
$END += 98
Wend
Exit
Else
MsgBox(0,"","Aucune saisie !")
Exit
EndIf
Func _GSpeech($Text)
$Data = _URIEncode($Text)
InetGet("http://translate.google.com/translate_tts?ie=UTF-8&tl=fr&q=" & $Data,@TempDir & "\temp.mp3",1)
$sound = _SoundOpen(@TempDir & "\temp.mp3")
_SoundPlay($sound,1)
_SoundClose($sound)
EndFunc
Func _URIEncode($sData)
; Prog@ndy
Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"")
Local $nChar
$sData=""
For $i = 1 To $aData[0]
ConsoleWrite($aData[$i] & @CRLF)
$nChar = Asc($aData[$i])
Switch $nChar
Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126
$sData &= $aData[$i]
Case 32
$sData &= "+"
Case Else
$sData &= "%" & Hex($nChar,2)
EndSwitch
Next
Return $sData
EndFunc
Func _CountString($string, $Opt=0)
If $string = "" Then Return 0
If $Opt < 0 Or $Opt > 1 Then Return 0
If $Opt = 1 Then $string = StringReplace($string, " ", "") ;=> Options on compte que les caractères sans espaces ou avec
$string = $string & "$"
Local $count = 0, $iMax = 1, $END = "true" ;==> Variables
While $END = "true"
If Stringleft($string, $iMax) <> "" Then $iMax += 1 ;=> si il y a quelque chose on ajoute un caractère
If StringTrimLeft($string, $iMax) = "$" Then $END = "false"
Wend
Return $iMax
Endfunc
J'ai fait la correction et rajouter un filtre pour que sa ne coupe plus
en plein milieu d'un mot !
Donc voila le script normalement fini et sans erreurs