Automator实现右键百度翻译

打开Automator,新建service
接着

Paste_Image.png

第二步,选择run applescript

on run {input, parameters}
    set output to "http://fanyi.baidu.com/?aldtype=16047&tpltype=sigma#en/zh/" & urldecode(input as string)
    return output
    
end run
on urldecode(x)
    set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp).gsub(\"+\",\"%20\")'"
    do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode

第三步,如图

Paste_Image.png

使用是右键就可以了

Paste_Image.png

同时给出一个朗文词典的办法,修改第二步的代码就可以了!

on run {input, parameters}
    set output to "http://www.ldoceonline.com/dictionary/" & input as string
    return output
end run

有道词典

on run {input, parameters}
    set output to ("http://m.youdao.com/dict?le=eng&q=" & input as string)
    return output
end run

当然啦,这些用popclip也可以实现,不过那个要跳转,比较麻烦!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容