Automator實(shí)現(xiàn)右鍵百度翻譯

打開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

同時(shí)給出一個(gè)朗文詞典的辦法,修改第二步的代碼就可以了!

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

當(dāng)然啦,這些用popclip也可以實(shí)現(xiàn),不過那個(gè)要跳轉(zhuǎn),比較麻煩!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 179,230評(píng)論 25 708
  • Run Loops Run loops是與線程相關(guān)的基礎(chǔ)框架的一部分。一個(gè)run loop是一個(gè)循環(huán),在這個(gè)循環(huán)中...
    nemie閱讀 992評(píng)論 0 2
  • 在MAC上右鍵菜單的翻譯功能只能是中->英,畢竟是蘋果詞典,雖然翻譯快,不過很多時(shí)候這不是我們想要的結(jié)果。所以現(xiàn)在...
    Riven2018閱讀 15,041評(píng)論 15 4
  • 最近接了一個(gè)外包的小項(xiàng)目,一個(gè)月的開發(fā)周期,急急忙忙的完成后,寫下一點(diǎn)心得。 1. 前期準(zhǔn)備 1.1 預(yù)估項(xiàng)目難度...
    _proto_麻瓜一袁閱讀 696評(píng)論 0 0
  • 最難持守的恰恰是人自己的內(nèi)心,一如我們的純真和青春……幾年時(shí)光對(duì)于人生,到底可以帶來(lái)怎樣的變化?面對(duì)現(xiàn)實(shí),是否還能...
    上官凡書閱讀 1,031評(píng)論 15 17

友情鏈接更多精彩內(nèi)容