Google TTS speech after click Liston Button

Status
Not open for further replies.

Dossfm0q

Banned User
Joined
Mar 9, 2009
Messages
570
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
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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:
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top