Skip to content

Instantly share code, notes, and snippets.

@nacyot
Last active March 2, 2022 15:10
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nacyot/d10f864d63cf2ceeab84 to your computer and use it in GitHub Desktop.
Save nacyot/d10f864d63cf2ceeab84 to your computer and use it in GitHub Desktop.
OSX Dictionary Lookup History Service
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