Sign in to follow this  
Followers 0
jonson1986

Google translator from Russian to English Not Working

1 post in this topic

#1 ·  Posted

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)

 

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • falcontechnics
      By falcontechnics
      Dear master, hello,
      I got the speech API from Google. But I could not find how to use. Could you help me with a simple example?
      "https://speech.googleapis.com/v1/speech:recognize?key=MyKey"
    • ct253704
      By ct253704
      Good morning,
      I am struggling to find a way to force a ControlClick on a particular hidden element within a Google Slides window. Using Au3Info doesn't work as the hidden text won't appear when attempting to gather the data. Using inspect element will show the class/title of the button, but using the class in the ControlClick function doesn't seem to do anything. Since this script is going to be running on multiple machines with different resolutions, MouseClick isn't a good option either. Can someone help me figure out how to click this full screen button?
      One more note - It says "Ctrl + Shift + F" for full screen, however sending that combo doesn't work - nor does actually using those keys on the keyboard. Possible conflict with AutoIT hotkeys? 
      Here's some sample code / screenshots to help:
      ControlClick($Title, "", "[CLASS:punch-viewer-icon punch-viewer-full-screen goog-inline-block]")  


    • nacerbaaziz
      By nacerbaaziz
      Hi guys
      In this publication I will share with you a function i have written it
      This function enables you to get names of days in three languages
      English, French and Arabic
      It automatically recognizes the language of your system
      If you want, you can customize the display language you want
      English = 0
      Arabic = 1
      French = 2
      get_day_name.au3
    • LeloDragneel
      By LeloDragneel
      Hey guys,
      I'm looking to implement an accurate voice recognition method in my program. I tried to understand the Microsoft SAPI API, read their online documentation and found it very confusing and unclear. (Like seriously, it's so bad and vague, but that's just my opinion). I have also tried using UTTER UDF, but could not get a grasp either, because you know, that's an extension UDF to Microsoft SAPI.
      Let's face it, the Google Speech Recognition is much more accurate than Microsoft SAPI (by far). Right now, I am determined to just use the Google Speech API. I have dug deep in regards to implementing the Google Speech API in AutoIT and I haven't found even one post about it. I suppose it's because the Google Speech API was only recently made available to the public. In case you don't know what I'm talking about, here's the link to google api. On that page, notice that there is language support for various languages such as Java, C#, and PHP. However, there's no support for AutoIT. So my question is; how can I go about implementing the Google Speech API into my AutoIT program? Is it even possible?
      Cheers guys!
    • jonson1986
      By jonson1986
      Hello,
      I've thousands of URLs to check them these are safe, malware infected or any other type of error, that's why I searched and found Google Safe browsing API with this we can send HTTP GET request so different code will return to make us clear is it our sent URL is safe or not. Please guide me how can i make this possible I know basics of Auotit but don't know how to use this API to fulfill above mentioned purpose. Your help will be much appreciated. Thanks
      Here is API URL;
      https://developers.google.com/safe-browsing/v3/lookup-guide