Mac google翻译

首先打开 Automator ,新建文稿,文稿类型选"服务",在左上的搜索框输入:"apple",找到"运行 AppleScript"项后双击,在右侧的编辑区,删除默认添加的代码,粘贴以下代码:

on run {input, parameters}        

set output to "谷歌网址/#auto/zh-CN/" & urldecode(input as string)        

return outputend runon urldecode(x)        

set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"        

do shell script "echo " & quoted form of x & " | ruby -e " & cmd

end urldecode

上述代码里 "/#auto" 表示自动检测语言,"/zh-CN/" 表示翻译为简体中文,你可以根据你自己的需求,改为"中译英""日译繁中""德译法"等等,具体的语言代码请浏览器打开 谷歌翻译选择语言后在地址栏获取。

服务可能楼主等级不够吧。。不让我发链接。。代码也乱了。我把代码贴图上了,大家看一下吧。接下来继续搜索"菜单",找到"网站弹出式菜单"项双击,在右侧的编辑区可以修改部分设置,比如大小选择"自定",个人建议大小设为 720×480 ,位置选择"鼠标指标"。最后保存,起一个名字。

使用:

在任何地方,选中文本,然后服务,找到对应的名字就可以了。你还可以在设置里修改该服务的快捷键。具体设置是在:设置》键盘》


on run {input, parameters}

set output to "https://translate.google.cn/#auto/zh-CN/" & urldecode(input as string)

return output

end run

on urldecode(x)

set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"

do shell script "echo " & quoted form of x & " | ruby -e " & cmd

end urldecode



关闭google鼠标左滑返回

defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE


猜你喜欢

转载自blog.csdn.net/yyjjyysleep/article/details/80987028