Adding words to the Apple dictionary

Discussion in 'Apple' started by Michelle Steiner, Mar 23, 2007.

  1. I wrote an Applescript to let you batch add words to the user
    dictionary.

    The script will prompt you to enter the words, one at at time, pressing
    return (or clicking the "enter") button after each word. When you're
    finished, click the "Finished" button.

    Then it asks you to choose the dictionary to add the words to; choose
    the file named "en" (if you're adding to the English language
    dictionary).

    That's it.

    Copy the following script, paste it into Script Editor and save it.
    Probably best to save it as an application so you won't have to run
    Script Editor in order to run the script.

    set additions to ""
    set finished to false
    repeat until finished is true
    display dialog ¬
    "Enter the next word to add to the user dictionary." & return & ¬
    "Press the Finished button when you're finished" with title ¬
    "Add words to spelling dictionary" default answer ¬
    "" buttons {"Cancel", "Finished", "Add word"} default button 3
    if button returned of the result is "Finished" then
    exit repeat
    else
    set additions to ¬
    (additions & the text returned of the result as text) ¬
    & (ASCII character 0)
    end if
    end repeat

    set UserFile to choose file with prompt ¬
    "Please choose the dictionary file to add the words to." default
    location ¬
    alias ((path to library folder from user domain as text) & "spelling")
    set fileRef to open for access UserFile with write permission
    set starting_point to (get eof of fileRef) + 1
    write additions to fileRef starting at starting_point
    close access fileRef
     
    Michelle Steiner, Mar 23, 2007
    #1
    1. Advertisements

  2. Thanks! This will definitely work well for me, as I use a lot of foreign
    non-standard words in my English dictionary.
     
    Joey DoWop Dee, Mar 23, 2007
    #2
    1. Advertisements

  3. Thanks to Michelle,
    however -- no joy on deploy.

    Fixed extraneous return (between default and location).
    Ran it in Script Editor.
    Restarted Dictionary. No joy.

    Saved as app.
    Ran it.
    Restarted Dictionary. No joy.

    Ideas? Tips? What did I do wrong?

    10.4.6 on G4\400

    Thanks,
     
    JoanD'arcRoast, Mar 23, 2007
    #3
  4. This for the spelling dictionary, not the definitions dictionary. And
    after posting the script, I found a problem. The "en" file checks for
    correct spelling, but it doesn't offer suggested alternatives.

    So if you enter a word and later on spell it as you entered it, it won't
    mark that as an error, but if you misspell the word you entered, it will
    mark it as an error, but not offer your word as an alternative. I
    haven't figured out where the suggestions are stored.
     
    Michelle Steiner, Mar 23, 2007
    #4
  5. But words entered through the "Learn" command in the normal spelling
    interface don't show up as suggestions either.
    Apparently, only those words in the basic dictionary can ever be offered
    as suggestions.

    So I'm going to leave it as it is.
     
    Michelle Steiner, Mar 23, 2007
    #5
  6. Oops. Now I feel abashed. Editing 'Dictionary' app would be fun. Can
    you believe it lacks "zerk"? Neither can I! :)

    Actually, the game TextTwist really irks because it lacks so many legal
    solutions. I poked around with Resorcerer, but it wasn't apparent (to a
    non-geek) how to make the game utilize a different dictionary...

    Thanks, -j
     
    JoanD'arcRoast, Mar 24, 2007
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.