0

I am trying to improve my vocabularies so am hoping to log all the search I made on mac dictionary. I have found a link which probably a bit outdated so it doesn't work, thought I do get the file on my desktop but no history is logged. http://hints.macworld.com/article.php?story=20121106085330476 Just seeing if there are others who can help me on this.

thanks

1

The following AppleScript code can be used in an Run AppleScript action as an Automator Service, and assigned a keyboard shortcut to act on a selected word to open it in the Dictionary, and log it, if it isn't already in the log file.

on run {input, parameters}
    try
        considering diacriticals
            if first character of (input as text) is not in "abcdefghijklmnopqrstuvwxyz" then
                tell current application
                    activate
                    display dialog "The selected text starts with a non-valid character." & return & return & ¬
                        "Make a different selection and try again." buttons {"OK"} default button 1 ¬
                        with title "Dictionary Look Up Logging Service"
                end tell
                return
            end if
        end considering
        open location "dict://" & input
        set theDictionaryHistoryFilename to "Dictionary Look Up Service History Log File.txt"
        set theTargetFilename to quoted form of (POSIX path of (path to documents folder as string) & theDictionaryHistoryFilename)
        set foundSelectedWord to (do shell script "grep '^" & input & "$' " & theTargetFilename & " > /dev/null; echo $?") as integer
        if foundSelectedWord is greater than 0 then
            do shell script "echo \"" & input & "\" >> " & theTargetFilename
        end if
    end try
end run

Note that if the log file is open when the service is run, the added word may not appear until you close and reopen the log file, depending on what app you have the log file open in.

Log Dictionary Look Up Automator Service

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .