I tried creating a script to automatically search definitions and log the word to a document. Keystroke doesn't seem to work:
on run {input, parameters}
-- Save current clipboard content to restore later
set oldClipboard to the clipboard
-- Copy selected text
tell application "System Events" to keystroke "c" using {command down}
delay 0.1 -- small wait for clipboard to update
set theWord to the clipboard as text
-- Safety check (no selection or blank)
if theWord is "" then
set the clipboard to oldClipboard
return
end if
-- Log file path
set logPath to (POSIX path of (path to desktop)) & "dictionary_log.txt"
do shell script "touch " & quoted form of logPath
-- Append the word to the log
do shell script "echo " & quoted form of theWord & " >> " & quoted form of logPath
-- Open Dictionary to that word
do shell script "open dict://" & quoted form of theWord
-- Restore clipboard
set the clipboard to oldClipboard
end run
Only the last word on the clipboard is being searched, and it doesn't log. Permissions were enabled.