F9:: Send, ^c ClipWait,2 If ErrorLevel ;如果粘贴板里面没有内容,则判断是否有窗口定义 Return Youdao_keyword=%Clipboard% Youdao_译文:=YouDaoApi(Youdao_keyword) Youdao_音标:= json(Youdao_译文, "basic.phonetic") Youdao_基本释义:= json(Youdao_译文, "basic.explains") Youdao_网络释义:= json(Youdao_译文, "web.value") If Youdao_基本释义 { Gui Gui_youdao_danci:add,Edit,x10 y10 w300 h100,%Youdao_音标% Gui Gui_youdao_danci:add,Edit,x10 y120 w300 h100,%Youdao_基本释义% Gui Gui_youdao_danci:add,Edit,x10 y230 w300 h100,%Youdao_网络释义% } Else { Youdao_音标:=RegExReplace(Youdao_译文,"m)({""translation"":["")|(""],""query"":.*)") Gui Gui_youdao_danci:add,Edit,x10 y10 w300 h300,%Youdao_音标% } Gui Gui_youdao_danci:show,,有道网络翻译 Return Gui_youdao_danciGuiClose: Gui_youdao_danciGuiEscape: Gui Gui_youdao_danci:destroy Return YouDaoApi(KeyWord) { KeyWord:=Sub_UrlEncode(KeyWord,"utf-8") url:="http://fanyi.youdao.com/fanyiapi.do?keyfrom=xxxxxxxx&key=1360116736&type=data&doctype=json&version=1.1&q=" . KeyWord WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1") WebRequest.Open("GET", url) WebRequest.Send() result := WebRequest.ResponseText Return result } json(ByRef js, s, v = "") { j = %js% Loop, Parse, s, . { p = 2 RegExMatch(A_LoopField, "([+-]?)([^[]+)((?:[d+])*)", q) Loop { If (!p := RegExMatch(j, "(?