Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add words to the spelling dictionary via AppleScript System
If you have a number of words to add to Apple's spelling dictionary, it can get cumbersome; you have to type the words into a document, then spell check and add them one at a time. Or, as detailed in this previous hint, you can open the "en" file (for English) and type them there, copying and pasting a non-printable character (represented by an upside-down question mark in the file). Until now, that is.

Now you can simply run this Applescript that I wrote. You type each word, press Enter after each word, and then click the Finished button after you're, well, finished. Then click on the dictionary file you wish to update (normally the "en" file for English), and it's done.

[robg adds: I couldn't get this one to work in my testing, but it's working for the author and others, so here it is -- please post your experiences, especially if it won't work for you and you can figure out why :). On my machine, the script works, and I can apparently add words, but they continue to show up as misspelled in my documents.]
    •    
  • Currently 2.75 / 5
  You rated: 2 / 5 (4 votes cast)
 
[12,099 views]  

Add words to the spelling dictionary via AppleScript | 8 comments | Create New Account
Click here to return to the 'Add words to the spelling dictionary via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add words to the spelling dictionary via AppleScript
Authored by: DougAdams on May 02, '07 08:06:00AM
Worked for me after I logged out and back in. Also, watch out for how the script compiles. This is how I reformatted it in Script Editor (adding nothing, just moving stuff around a little):
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

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]

Add words to the spelling dictionary via AppleScript
Authored by: klktrk on May 02, '07 03:39:44PM
A little redundancy in the script: At the top of the loop you have:
set finished to false
repeat until finished is true
but then the loop is broken with
if button returned of the result is "Finished" then
		exit repeat
Shouldn't that be
if button returned of the result is "Finished" then
		set finished to true


[ Reply to This | # ]
Add words to the spelling dictionary via AppleScript
Authored by: DougAdams on May 03, '07 08:18:07AM
If I may suggest: actually you don't need the "until" or finished variable at all. The routine would work just as well as:
set additions to ""
repeat
	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
No matter what, the only two ways out of the loop are to click "Finished" or "Cancel", the latter aborting the script entirely.

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]

Add words to the spelling dictionary via AppleScript
Authored by: blgrace on May 02, '07 03:45:49PM

Didn't work for me.
The script functions correctly and it does add my new words to the appropriate file: ~/Library/Spelling/en_AU (in my case) - but anything added this way does not seem to be recognised.
The added words are still flagged even after logging out and back in.

If I add the same word again using the "Learn" function inside spell check, then it works. Looking at my en_AU file, there are duplicates.

I'm at a loss as to why this might be.



[ Reply to This | # ]
Location of spelling additions?
Authored by: germ on May 02, '07 01:49:49PM

There is no ~/Library/Spelling folder in my system, although I have added several words to my dictionary.

Anybody know the correct location of this folder??



[ Reply to This | # ]
Location of spelling additions?
Authored by: michelle_eris on May 02, '07 03:06:04PM

You sure you're looking at it from the same account? I just created a new account. ~/Library/Spelling didn't exist. I typed "frumble" in Text Edit and then added it to the dictionary; it immediately created ~/Library/Spelling and the "en" file, with "frumble" as the only entry.



[ Reply to This | # ]
Macbook hard drive full when there should be 30GB free
Authored by: davidsmw on May 07, '07 02:42:15AM

My new 120GB Macbook is registering near full when there should be at least 30GB free. I've downloaded Whatsize and it says : /private/var/log/windowserver_last.log has used 29.9GB. I've downloaded Onyx in an attempt to find & get rid of windowserver_last.log. But alas it is in vane. Won't show where "private" is. Any advice?



[ Reply to This | # ]
Macbook hard drive full when there should be 30GB free
Authored by: davidsmw on May 07, '07 04:11:58AM

Think I've cracked it. Downloaded Tinkertool found the file and zapped it with Onyx.



[ Reply to This | # ]