Jump to content

Search the Community

Showing results for tags 'translator'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. Hey I searched code on autoit forum and modify it according to my needs and try to translate text from Russian to English in return I'm getting error such as "Error 411 (Length Required)!!1" Both my autoit codes and error I got are given below, please help me to solve this issue, Thanks Autoit codes to translate text form Russian to English; #include <urlencode.au3> $File1 = @ScriptDir & "\russian_text.txt" $txt = FileRead($File1) ; Try to convert line breaks with .....so final URL looks simpler $txt = StringReplace($txt, @CRLF, '...........') $txt = StringReplace($txt, @LF, '.............') $txt = StringReplace($txt, @CR, '.............') FileWrite (@scriptdir & '\russian_text2.txt', $txt) $openfile = @ScriptDir & "\russian_text2.txt" $mytext = FileRead ($openfile) $encoding = urlencode ($mytext) FileWrite (@scriptdir & '\enooding.txt', $encoding) $from = "ru" $to = "en" $url = "https://translate.googleapis.com/translate_a/single?client=gtx" $url &= "&sl=" & $from & "&tl=" & $to & "&dt=t&q=" & $encoding $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("POST", $url, False) $oHTTP.Send() $sData = $oHTTP.ResponseText $sData = StringRegExpReplace($sData, '.*?\["(.*?)(?<!\\)"[^\[]*', "$1" & @crlf) FileWrite (@scriptdir & '\errorcode.txt', $sData) Msgbox(0,"", $sData) In response of above codes, I'm getting below error; <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 411 (Length Required)!!1</title> <style> *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px} </style> <a href=//www.google.com/><span id=logo aria-label=Google></span></a> <p><b>411.</b> <ins>That’s an error.</ins> <p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins>
  2. Hello, I'm trying to translate with google translator but not able to translate my text file from Russian to English and my output saved in text file is 0 instead of any translated text. I'm using a text file which contains 5 lines of Russian language and I want to translate it into English language and want to save it in other text file translated.txt but I'm not able to let it happen. Please help me how can I make this possible same code was working several months ago but not now especially don't know what's going wrong with my code of google translator. Here are my codes #RequireAdmin #include <IE.au3> #include <String.au3> #include <Array.au3> ProcessClose ( 'iexplore.exe') $File1 = @ScriptDir & "\kat01.txt" $txt = FileRead($File1) ;-------------------------------Translation Started------------------------- Local $tag="* # * # *" Local $oIE=_IECreate("https://translate.google.com/#ru/en", 1, 1) Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & $txt & @CR & $tag) _IEFormSubmit($oForm) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) ;_IEQuit($oIE) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0]) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines[0]=UBound($lines)-1 _ArrayDisplay($lines) Local $sFilePath = @ScriptDir & "\Translated.txt" _FileWriteFromArray($sFilePath, $lines, 1)
  3. Hello I'm trying to translate few text using below code, I found it working previously couple of months ago but Now these days it's not working at all and I'm getting below errors when I run the script and Array display at the end of text also not able to show any translated text instead of value 0 & 1; --> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (gt-res-data) --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType Here is code, #include <IE.au3> #include <Array.au3> Local $tag="* # * # *" Local $oIE=_IECreate("https://translate.google.com/#auto/es") Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & "Hello World" & @CR & "This is a test" & @CR & $tag) _IEFormSubmit($oForm) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) _IEQuit($oIE) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0]) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines[0]=UBound($lines)-1 _ArrayDisplay($lines)
  4. Hey, So I'm trying to create a translation script to translate text from english to spanish. It seems my program crashes if i have more than 1 child in the html.(i will highlight it via comment) I am also occasionally crashing after my 5 second, while busy, loop. Any help or insight would be greatly appreciated. $langFrom = "en" $langTo = "es" While 1 Sleep(250) Translate() Wend Func Translate() $ie = ObjCreate("InternetExplorer.Application") $ie.visible = True $toTrans = InputBox("Translate", "Enter text to translate [" & $langTo & "]") $ie.Navigate("https://translate.google.ca/?ie=UTF-8&hl=" & $langFrom & "&client=tw-ob#auto/" & $langTo & "/" & $toTrans) $result = "" While($ie.busy) Sleep(5000) WEnd ;occasionally crashing here (unsure cause) While($result = "") $result = $ie.document.getElementById("result_box").innerHTML sleep(250) WEnd $children = $ie.document.getElementById("result_box").childNodes ;suspect i did something wrong here $result = "" for $child in $children $result = $result & $child.innerHTML & " " ;crashing here Next ;cleanup $result = StringReplace($result," "," ") $result = StringReplace($result," ."," ") $ie.quit() MsgBox(0,"Translated", $result) EndFunc
×
×
  • Create New...