Last active
March 2, 2022 15:10
-
-
Save nacyot/d10f864d63cf2ceeab84 to your computer and use it in GitHub Desktop.
OSX Dictionary Lookup History Service
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 run {input, parameters} | |
set logPath to "Dropbox/Dictionary/words.txt" | |
set lookUpWord to quoted form of (input as string) | |
tell application "System Events" to tell (process 1 where frontmost is true) | |
set windowTitle to name | |
try | |
set windowTitle to windowTitle | |
set titleBar to name of window 1 | |
end try | |
end tell | |
# do shell script ¬ | |
# "cd; echo '{ word: \"" & lookUpWord & ¬ | |
# "\", windowTitle: \"" & windowTitle & ¬ | |
# "\", titleBar: \"" & titleBar & ¬ | |
# "\" },' >> " & quoted form of logPath | |
set timeStamp to do shell script "date +%s" | |
do shell script ¬ | |
"cd; echo 'date:" & timeStamp & "\tword:" & lookUpWord & "\twindowTitle:" & windowTitle & "\ttitleBar:" & titleBar & "' >> " & quoted form of logPath | |
do shell script "open dict://" & lookUpWord | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment