Untitled
ahunknown
plain_text
3 years ago
896 B
9
Indexable
^+T::
Send, ^c
Clipboard =
ClipWait
If ErrorLevel
{
MsgBox, No text was selected.
return
}
translatedText := ""
URL := "https://translate.google.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=" . Clipboard
HTML := ""
URLDownloadToVar, HTML, %URL%
StringReplace, HTML, HTML, , `n, All
StringReplace, HTML, HTML, , , All
Loop, Parse, HTML, `n
{
If InStr(A_LoopField, """translatedText"":")
{
StringReplace, translatedText, A_LoopField, """translatedText"":""", """
StringReplace, translatedText, translatedText, """", """
Break
}
}
If translatedText = ""
{
MsgBox, Translation failed.
return
}
MsgBox, %translatedText%
return
Editor is loading...