Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance Force
- SetTitleMatchMode, 2
- SetWorkingDir, A_ScriptDir
- SetBatchLines -1
- ListLines Off
- SendMode Input
- Insta_Translator:
- ;Gui +Resize
- Gui Add, Text, x5 h19, ### [Enter] で翻訳開始 ###
- Gui Add, Text, x5 y+1 h19, -----------------------------------------------------------------
- Gui Add, Text, x5 y50 h19, 日本語に変換する→ ←英語に変換する
- Gui Add, Edit, x5 y75 w200 h150 vENGLISH gConvert_1st_Action
- Gui Add, Edit, x215 y75 w200 h150 vJAPANESE gConvert_1st_Action
- Gui, Show,, 翻訳機
- return
- Convert_1st_Action:
- ControlActual := GuiGetFocus()
- ;gosub, Convert_2nd_Action
- return
- #IfWinActive, 翻訳機
- ~Enter::
- Convert_2nd_Action:
- Gui, Submit, NoHide
- If ControlActual = ENGLISH
- {
- ;TrayTip, Convert Status, Waiting...
- GuiControl,, JAPANESE, [Analizando...]
- GuiControl,, JAPANESE, % AHK_Traducir(ENGLISH, "ja")
- }
- If ControlActual = JAPANESE
- {
- Sleep, 100
- ;TrayTip, Convert Status, Waiting...
- GuiControl,, ENGLISH, [分析中...]
- GuiControl,, ENGLISH, % AHK_Traducir(JAPANESE " ", "en")
- ;TrayTip, Convert Status, Ready!
- }
- return
- AHK_Traducir(Texto,Hacia) {
- Loop {
- IfWinExist, ahk_exe iexplorer.exe
- Process, Close, iexplorer.exe
- else
- break
- } pwb := ComObjCreate("InternetExplorer.Application")
- pwb.Visible := False
- pwb.Navigate("https://translate.google.com/#auto/" Hacia "/" Texto)
- While pwb.readyState != 4 || pwb.document.readyState != "complete" || pwb.busy
- Sleep, 500
- Translation := pwb.document.all.result_box.InnerText
- Sleep, 100
- pwb.Quit
- return , Translation
- }
- GuiGetFocus()
- {
- GuiControlGet out, FocusV
- return out
- }
- GuiClose:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement