Created
November 24, 2012 18:26
-
-
Save mh61503891/4140800 to your computer and use it in GitHub Desktop.
辞書.appとEOWをバックグラウンドで字引きしてついでに喋ってくれるスクリプト。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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