The code is meant to translate some
Code: Select all
#NoEnv
#SingleInstance force
;########## Source: https://autohotkey.com/boards/viewtopic.php?t=21105
^+t::
;phrase := Clipboard
phrase := "Jonny continues to struggle in school.."
LangIn := "en"
LangOut := "es"
varSpan := % GoogleTranslate(phrase,LangIn,LangOut)
1stPhrase := phrase
;MsgBox, varSpan %varSpan%
phrase := varSpan
LangIn := "es"
LangOut := "en"
varEng := % GoogleTranslate(phrase,LangIn,LangOut)
;MsgBox, varEng %varEng%
GoogleTranslate(phrase,LangIn,LangOut)
{
base := "https://translate.google.com.tw/?hl=en&tab=wT#"
path := base . LangIn . "/" . LangOut . "/" . phrase
IE := ComObjCreate("InternetExplorer.Application")
;IE.Visible := true
IE.Navigate(path)
While IE.readyState!=4 || IE.document.readyState!="complete" || IE.busy
Sleep 500
Result := IE.document.all.result_box.innertext
IE.Quit
return Result
}
MsgBox, Started with: `t %1stPhrase%`n`nAs Spanish:`t %varSpan%`n`nBack to English: `t %varEng%
;Clipboard := varSpan