elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  [SPINET]Google Speak
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [SPINET]Google Speak  (Leído 2,666 veces)
LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
[SPINET]Google Speak
« en: 1 Diciembre 2010, 06:28 am »

Holas, esta es una simple función para utilizar el api de google speak, sirve para llevar un texto a vos, el apis se limita solo a 100 caracteres, cuenta con tres parámetros el primero es el texto a pronunciar, el segundo la acentuación (español ="es"), y el tercero para llamar a DoEvents si se quiere.
Fuente original

Código
  1. Option Explicit
  2. '-----------------------------------------------------------------------------------------------------
  3. 'Autor: Leandro Ascierto
  4. 'Web: www.leandroascierto.com.ar
  5. 'Abreviaturas
  6. 'de, da, es, fi, fr, en, it, nl, pl, pt, sv"
  7. 'Alemán , Danés, Español, Finlandia, Francés, Inglés, Italiano, Neerlandés, Polaco, Portugués, Sueco
  8. '----------------------------------------------------------------------------------------------------
  9. Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
  10. Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
  11.  
  12.  
  13. Public Function GoogleSpeak(ByVal sText As String, Optional ByVal Language As String = "es", Optional ByVal bDoevents As Boolean) As Boolean
  14.    On Error Resume Next
  15.    Dim sTempPath As String, ml As String
  16.    Dim FileLength As Long
  17.  
  18.    sText = Replace(sText, vbCrLf, " ")
  19.  
  20.    If Len(sText) > 100 Then Exit Function
  21.  
  22.    sTempPath = Environ("Temp") & "\TempMP3.MP3"
  23.  
  24.    If URLDownloadToFile(0&, "http://translate.google.com/translate_tts?tl=" & Language & "&q=" & sText, sTempPath, 0&, 0&) = 0 Then
  25.  
  26.        If mciSendString("open " & Chr$(34) & sTempPath & Chr$(34) & " type MpegVideo" & " alias myfile", 0&, 0&, 0&) = 0 Then
  27.  
  28.            ml = String(30, 0)
  29.            Call mciSendString("status myfile length ", ml, 30, 0&)
  30.            FileLength = Val(ml)
  31.            If FileLength Then
  32.                If mciSendString("play myFile", 0&, 0&, 0&) = 0 Then
  33.                    Do While mciSendString("status myfile position ", ml, 30, 0&) = 0
  34.                        If Val(ml) = FileLength Then GoogleSpeak = True: Exit Do
  35.                        If bDoevents Then DoEvents
  36.                    Loop
  37.                End If
  38.            End If
  39.            Call mciSendString("close myfile", 0&, 0&, 0&)
  40.  
  41.        End If
  42.  
  43.        Kill sTempPath
  44.    End If
  45.  
  46. End Function
  47.  
  48.  
  49. Private Sub Command1_Click()
  50.   Debug.Print GoogleSpeak("Antes era sexo droga y rock and roll, ahora es paja mate y chamame", "es", True)
  51.    Debug.Print GoogleSpeak("Siamo fuori della copa. un giorno tristissimo", "it", True)
  52. End Sub
  53.  


Saludos.


« Última modificación: 1 Diciembre 2010, 06:45 am por LeandroA » En línea

agus0


Desconectado Desconectado

Mensajes: 360



Ver Perfil
Re: [SPINET]Google Speak
« Respuesta #1 en: 1 Diciembre 2010, 10:51 am »

Esta de Diez pero... "URLDownloadToFile" no hace saltar la Heuristica de bastantes antivirus??


En línea

LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Re: [SPINET]Google Speak
« Respuesta #2 en: 1 Diciembre 2010, 15:13 pm »

Esta de Diez pero... "URLDownloadToFile" no hace saltar la Heuristica de bastantes antivirus??

si, puse esa api por practicidad pero se puede usar cual quier otro metodo para descargar, por ejemplo este

Saludos.
En línea

agus0


Desconectado Desconectado

Mensajes: 360



Ver Perfil
Re: [SPINET]Google Speak
« Respuesta #3 en: 1 Diciembre 2010, 18:59 pm »

jajaja me imagine que se puede usar cualquiera solo te decía.

Ya lo vi el método ese si me lo paso BlackZeroX a mi :P
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
We don't speak americano (Drunk Version)
Foro Libre
KarlosVid(ÊÇ) 1 1,865 Último mensaje 23 Noviembre 2010, 04:34 am
por do-while
[Perl] Funcion Speak()
Scripting
BigBear 0 1,542 Último mensaje 10 Octubre 2011, 16:51 pm
por BigBear
[Ruby] Funcion speak()
Scripting
BigBear 0 1,388 Último mensaje 10 Febrero 2012, 19:02 pm
por BigBear
Wireshark Team Speak 3
Redes
Juancamunoz 5 4,078 Último mensaje 23 Diciembre 2014, 12:18 pm
por el-brujo
Freetts bloqueado en speak
Java
Joss 0 1,492 Último mensaje 7 Enero 2017, 22:18 pm
por Joss
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines