I search for a way to add unknown words in a personal dictionary or vocabulary list only by right-clicking the word and choosing the add option (in macOS). It would be very helpful for me to add the words directly to a vocabulary list, without breaking my workflow. I already found an addon for chrome which resolves my problem (you can see it on the attached screenshot). But I need a similar (overarching) solution that works with various apps (like PDF reader (Preview in macOS), other web browsers (safari)..). If there isn't any app for this "issue", would it be difficult for somebody without specific Swift (or macOS development) knowledge but expertise in other languages to write a small (background) APP in swift for helping me out?enter image description here

  • 1
    Hi Shervin, welcome to Ask Different. Could you expand on what the vocabulary list should look like? Is it simply a list of words in a text file in your Documents folder or more sophisticated (for example, formatted and with additional information)? The former shouldn't be too difficult to implement with an Automator Service.
    – jaume
    Jun 18 '20 at 10:37
  • Hey Jaume, thank you for your answer! Yes, it should just append and save the words into a text file so that I have an overview of them. Do you think I can use the Automator service (of macOS) for that need?
    – Shervin
    Jun 18 '20 at 13:49
  • 1
    Yes, definitely, take a look at my answer.
    – jaume
    Jun 18 '20 at 21:13

You can create an Automator Quick Action that takes the selected word as input and saves it to a predefined document. The Quick Action can then be configured with a keyboard shortcut of your choosing.

Setting it up

  1. Launch Automator (located in /Applications).

  2. Create a new document of type "Quick Action": enter image description here

  3. Search for "shell" and drag the "Run Shell Script" action to the right panel: enter image description here

  4. Configure it to receive selected text from the current application and add this script, modifying ~/Documents/Vocabulary.txt to your needs (see below for a fancier script):

    if [ "$@" != "" ]; then
        echo "$@" >> ~/Documents/Vocabulary.txt

    enter image description here

  5. Save the Quick Action with a meaningful name like Save to Vocabulary List: enter image description here

  6. Open System Preferences>Keyboard>Shortcuts, select Services from the list on the left panel, enable the Quick Action and set a "complex" keyboard shortcut, for example ControlShiftCommandV, to reduce the change of a conflict with an existing one: enter image description here

  7. Open an app, select some text, press ControlShiftCommandV and the text will be added to the file configured in the Quick Action (~/Documents/Vocabulary.txt).

Going fancy

You can easily extend the script's functionality (basic scripting knowledge required). For example, to add a timestamp and a link to the Dictionary app, use this script instead (note that the vocabulary list is now saved to the HTML file ~/Documents/Vocabulary.html):

if [ "$@" != "" ]; then
    timestamp="$(date +%Y-%m-%d' '%H:%M:%S)"
    dictlink="dict://$(echo $@ | sed 's/ /%20/')"
    ahref="<A HREF=\"$dictlink\">$@</A>"

    echo "$timestamp - $ahref</br>" >> ~/Documents/Vocabulary.html

When opened in Safari, the vocabulary file looks like this:

enter image description here

and you can click the word to look it up in the Dictionary app.

  • Will this add those words to the standard dictionary?
    – Solar Mike
    Jun 19 '20 at 6:52
  • No, no words will be added to the standard dictionary. This will only add selected words to a text or HTML file.
    – jaume
    Jun 19 '20 at 8:39
  • 1
    wow, thank you so much for you excellent tutorial and your great solution. It is finally better than I imagined! I chose the name "Save to Vocabulary List by Jaume" ;)
    – Shervin
    Jun 19 '20 at 19:27
  • Wow, that's a huge compliment, thank you, I'm glad I could help!
    – jaume
    Jun 19 '20 at 21:02

You must log in to answer this question.

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