Skip to content

Instantly share code, notes, and snippets.

@mh61503891
Created November 24, 2012 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mh61503891/4140800 to your computer and use it in GitHub Desktop.
Save mh61503891/4140800 to your computer and use it in GitHub Desktop.
辞書.appとEOWをバックグラウンドで字引きしてついでに喋ってくれるスクリプト。
#!/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