2014-12-24 101 views
0

我在Applescript中制作了一个快速翻译器应用程序,它将您剪贴板上的任何内容放入Google翻译。它适用于基本的A-Z和几个符号。如果应用程序无法识别该字符,则只会写入“a”。我需要它来支持非拉丁文字符,如日文和符号。我尝试在第2行的末尾添加“作为Unicode文本”,但那不起作用。Applescript和非英文字符

get the clipboard 
set translateMe to the clipboard as Unicode text 
tell application "Safari" 
    activate 
end tell 
tell application "Safari" 
    activate 
    open location "https://translate.google.com" 
end tell 
delay 1 
tell application "System Events" 
    keystroke translateMe 
end tell 

回答

1

你可以使用URL语法是这样的:

tell application "Safari" 
    activate 
    open location "https://translate.google.com/#auto/en/" & (the clipboard) 
end tell