Last active
August 29, 2015 14:02
-
-
Save de1o/d1d386ef61d30242b228 to your computer and use it in GitHub Desktop.
an apple script used in launchbar 5(maybe other launchers also) which can call Youdao Dict to look for new words, and save the new words in an file so you can review them. still has some problem. like, won't work when Youdao Dict was on the frontmost.
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
on WriteToFile(this_data, target_file) -- (string, file path as string) | |
do shell script "echo " & quoted form of this_data & ">> " & quoted form of target_file | |
end WriteToFile | |
on WordQuery(theString) | |
tell application "YoudaoDict" to activate | |
tell application "System Events" | |
tell process "YoudaoDict" | |
try | |
key down command | |
keystroke (key code 51) | |
on error | |
key up command | |
end try | |
key up command | |
keystroke theString | |
keystroke return | |
end tell | |
end tell | |
end WordQuery | |
on handle_string(theString) | |
WordQuery(theString) | |
WriteToFile(theString, "/tmp/words.log") | |
end handle_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment