Skip to content

Instantly share code, notes, and snippets.

@qunwang6
Forked from mh61503891/dict.sh
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qunwang6/1d68f23091ac64a72af7 to your computer and use it in GitHub Desktop.
Save qunwang6/1d68f23091ac64a72af7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Description :: バックグラウンドで辞書.appで単語検索して、バックグラウンド
# でGoogle Chromeで英辞郎 on the Webで検索して、しまいには
# sayコマンドでしゃべってもらうスクリプト。
# EmacsとかSublime Text 2とかから叩くと便利です。
# Usage :: sh dict.sh "hello"
# Requiments :: Mac OS X, Gogle Chrome
# Note :: "Google Chrome"を"Safari"にしてexecute javascriptを
# do javascriptにすればSafariでも動くかもしれません。
# Author :: Masayuki Higashino
WORD=$1
open -g dict://"$WORD"
osascript -e "`cat <<EOF
tell application "Google Chrome"
tell tab 1 of window 1
set URL to "http://eow.alc.co.jp/search?q=" & "$WORD"
execute javascript "location='" & URL & "'"
end tell
end tell
EOF
`"
say "$WORD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment