Sign in to follow this  
Followers 0
JAFN

How do I get the text from the edit area of Google Translate?

6 posts in this topic

Hello yet again,

I have finished my initial script as I can think of nothing useful to add to it.

So I'm on to my next learning experience. And I don't know where to begin researching it.

What I want to do is create a simple two button window that swaps the two edit fields in Google translate running in chrome.

I want to figure most of this out on my own but need a starting point.

How do I get the ctrlID for one of the edit boxes of Google Translate?

Thanks


[size="2"]The second mouse gets the cheese[/size]

Share this post


Link to post
Share on other sites



I fear they are not usable controls for autoit. What you see on a webpage is all one control to autoit.

There are no UDFs for chrome as far as I know.

Options

Use IE

See if the test in the feilds are in the page source

Automate mouse to click fields, select and copy data


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

wow, I forgot how incredibly slow IE is. When I revisited Firefox I thought it was slow, but IE is glacial.

Not really seeing anything I understand.

I haven't done anything in site manipulation so I guess I will try that route. Don't even know the questions to ask on that one. So off to research. Thanks.


[size="2"]The second mouse gets the cheese[/size]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Mildly related.

$Chrome = @UserProfileDir & '\AppData\Local\Google\Chrome\Application\Chrome.exe '
Func Translate($sString = '')
    If $sString = '' then
        ;$sString = ClipGet()
        Send('^c')
        $sString = StringReplace($sString, Chr(0x0D), ' ')
    EndIf
    Run($Chrome & '"http://translate.google.com/#auto|en|' & $sString & '"')
EndFunc   ;==>Translate
Edited by BitByteBit

Share this post


Link to post
Share on other sites

Mildly related.

$Chrome = @UserProfileDir & '\AppData\Local\Google\Chrome\Application\Chrome.exe '
Func Translate($sString = '')
    If $sString = '' then
        ;$sString = ClipGet()
        Send('^c')
        $sString = StringReplace($sString, Chr(0x0D), ' ')
    EndIf
    Run($Chrome & '"http://translate.google.com/#auto|en|' & $sString & '"')
EndFunc   ;==>Translate

I am trying to do something similar to this, except I would like to invoke the "Listen" facility on Google Translate and (this is important) I would like to hear the source text. That is, I want to click the Listen button below the input box not the one below the translated text.

Now, because the input text can vary in length the location of the button can move. I have no knowledge of html or java to speak of, so can you tell me what I would need to send to Chrome to click that button programmatically? I can't help but think this should be easy to do, but I'm stuck!

Oh and tabbing down to it doesn't work, because you are sometimes offered a "Did you mean...?" option which interferes with the number of tabs that need to be sent :S

Share this post


Link to post
Share on other sites

I am trying to do something similar to this, except I would like to invoke the "Listen" facility on Google Translate and (this is important) I would like to hear the source text. That is, I want to click the Listen button below the input box not the one below the translated text.

Now, because the input text can vary in length the location of the button can move. I have no knowledge of html or java to speak of, so can you tell me what I would need to send to Chrome to click that button programmatically? I can't help but think this should be easy to do, but I'm stuck!

Oh and tabbing down to it doesn't work, because you are sometimes offered a "Did you mean...?" option which interferes with the number of tabs that need to be sent :S

You can do it this way...

$gspeech = "Hello, time is now, " & @HOUR & ". " & @MIN & ", goodbye"
speech()

Func speech()
Local $temp, $File
$temp = StringReplace($gspeech, " ", "+")
$File = StringRegExpReplace($gspeech, "([ .!])", "") 
If Not FileExists(@TempDir & "\" & $file & ".mp3") Then _
InetGet("http://translate.google.com/translate_tts?q=" & $temp, _
@TempDir & "\" & $file & ".mp3")
SoundPlay(@TempDir & "\" & $file & ".mp3", 1)
Return
EndFunc

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