回复 9# bob
更改翻译函数为以下内容:
Func _translate()
$xmlhttp = ObjCreate("Msxml2.XMLHTTP");
If $flag=1 Then
$xmlhttp.open("GET", "http://translate.google.cn/translate_a/t?client=t&sl=zh-CN&tl=en&hl=zh-CN&sc=2&ie=UTF-8&oe=UTF-8&prev=btn&ssel=3&tsel=6&q=" & _UnicodeURLEncode(GUICtrlRead($Edit1)) , False)
$xmlhttp.Send
$result = StringSplit($xmlhttp.responseText, ',')
If($result[0]<>0) Then
GUICtrlSetData($Edit2, "翻译结果:"&StringTrimRight(StringTrimLeft($result[1], 4),1)&@CRLF&"注音:"&StringTrimLeft(StringTrimRight($result[4], 3),1))
EndIf
Else
$xmlhttp.open("GET", "http://translate.google.cn/translate_a/t?client=t&sl=en&tl=zh-CN&hl=zh-CN&sc=2&ie=UTF-8&oe=UTF-8&prev=btn&ssel=4&tsel=6&q="& _UnicodeURLEncode(GUICtrlRead($Edit1)), False)
$xmlhttp.Send
$result = StringSplit($xmlhttp.responseText, ',')
If($result[0]<>0) Then
GUICtrlSetData($Edit2, "翻译结果:"&StringTrimRight(StringTrimLeft($result[1], 4),1)&@CRLF&"注音:"&StringTrimLeft(StringTrimRight($result[3], 1),1))
EndIf
EndIf
EndFunc ;==>_translate
|