Google TTS speech after click Liston Button

Status
Not open for further replies.

Dossfm0q

Well-known Member
Joined
Mar 9, 2009
Messages
509
Office Version
  1. 2019
Platform
  1. Windows
how to get URL below from Google TTS speech after click Liston Button from inspect Element >> F11 window >> then Network?
can I filter what I need as Medea then copy it through VBA ?
I have problem with ( "Ctrl+4 " SendKeys String:="^4") Some time works and some not, also Keyboard " Num Lock" deactivate how to reactivate

"https://translate.google.com.sa/tra...n=3&tk=656820.834353&client=webapp&prev=input"
VBA Code:
Public Sub Google_TTS()

''''''''''''''
ClosingIE ' Close open IE
'''''''''''''''
    Dim IE As InternetExplorer
    Set IE = Nothing
    Set IE = CreateObject("InternetExplorer.application")
    IELang = "hl=" & "en"
    TrnsFrom = "sl=" & "en"
    TrnsTo = "tl=" & "ar"
    TXT = "My Car" ' orActiveCell
    StrUrl = "https://translate.google.com/?" & IELang & "&tab=wT1&authuser=0#view=home&op=translate&" & TrnsFrom & "&" & TrnsTo & "&text=" & TXT
    With IE
    .Navigate StrUrl
    .Visible = True
  
        SendKeys String:="{F12}" ' call  Inspect Elements
      
        While .Busy Or .ReadyState < 4: DoEvents: Wend
        '.Document.queryselector(".ttsbutton").Click ' or
         Application.Wait Now + TimeValue("00:00:01")
        .Visible = True ' reactive IE for "Ctrl+4 "  SendKeys String:="^4"
        
        ' Some time work smoe not work
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
         SendKeys String:="^4" ' call  Inspect Elements Network
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
         While .Busy Or .ReadyState < 4: DoEvents: Wend

        .Document.queryselector(".src-tts").Click ' all of them work will
      
       '.Quit
       Set IE = Nothing
    End With
End Sub
Private Sub ClosingIE()

On Error Resume Next
    Dim objWMI As Object, objProcess As Object, objProcesses As Object
    Set objWMI = GetObject("winmgmts://.")
    Set objProcesses = objWMI.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'")
    For Each objProcess In objProcesses
        Call objProcess.Terminate
    Next
    Set objProcesses = Nothing: Set objWMI = Nothing
    On Error GoTo 0
End Sub
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,526
Office Version
  1. 365
Platform
  1. Windows
Duplicate to get Google Translate TTs Speech

Please do not post the same question multiple times. Questions of a duplicate nature will be locked or deleted, per #12 of the Forum Rules and points 6 & 7 of the Guidelines.

Any bumps, clarifications, or follow-ups should be posted to the linked thread.
 
Last edited:
Status
Not open for further replies.

Watch MrExcel Video

Forum statistics

Threads
1,119,185
Messages
5,576,582
Members
412,735
Latest member
jwoods1204
Top