GoogleBig - Forum

Full Version: [VBS] Google Translator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Autore: ctrl_alt_canc

Code:
' Ctrlaltcanc SECURITY BLOG
'http://ctrlaltcanccorp.altervista.org/Blog/

On Error Resume Next
stringainput = inputbox("Inserisci una parola inglese da tradurre: ","")

If Trim(stringainput) = "" Then
wscript.quit
Else

url = "http://translate.google.com/translate_t?langpair=en|it&text=" & stringainput

Set conness = CreateObject("MSXML2.XMLHTTP")
conness.Open "GET", url, FALSE
conness.Send
traduz = conness.ResponseText

Function RegExpTest(patrn, strng)
    Dim regEx, Match, Matches    
    Set regEx = New RegExp    
    regEx.Pattern = patrn    
    regEx.IgnoreCase = True    
    regEx.Global = True  
    Set Matches = regEx.Execute(strng)    
    For Each Match in Matches    
       RegExpTest = Match.Value  
    Next
End Function

traduz = RegExpTest("<div id=result_box dir=ltr>[a-zA-Z]+</div>", traduz)

traduz = replace(traduz, "<div id=result_box dir=ltr>", "")

traduz = replace(traduz, "</div>", "")
Dim aaa
set aaa   = CreateObject("Scripting.FileSystemObject")
Set uu = CreateObject("Wscript.Shell")

Wait 1, "Sto traducendo"

Sub Wait(Seconds, Message)
On Error Resume Next
Dim unz
If IsEmpty(unz) Then Set unz = CreateObject("wscript.shell")
unz.Popup Message, 1, "Attendere", 80000
End Sub
set aaa = nothing
Msgbox  traduz,,"Traduzione:"
End If

Reference URL's