Notepad++ and Aspell on Win7

Update: (28 June 2013; lots of folks still land on this blog post) Notepad++ 6.3.3 now uses DSpellCheck. The default dictionary is not US English. If you check this page (scroll down a bit) you’ll learn not only where the default dictionaries are installed, but that you can change it through the settings. That means you can put your User Dictionary file in a folder you own on Windows 7. You can find alternative dictionaries here. Download, unzip and put it either in the default location or someplace else and change the settings to find it. Enjoy.
Original Post:
You are surely aware Win7 is pretty cranky with permissions and the UAC. But it’s also good protection from sneaky installers and such. If you like the Notepad++ editor and want spellchecking, you’ll need to install Aspell with the appropriate language spelling dictionary.
The problem is you can’t use the built-in functions to add words directly which aren’t already in your Aspell dictionary. If you try, you’ll get an error about lacking permission to write to some file. There is a user dictionary function, but Win7 tends to block that as implemented in Notepad++ and there probably won’t be a fix any time soon (the problem is with Aspell, not Notepad++). Nor is it easy to figure out the work-around.
Here’s what I do: First, create in your own user Documents folder a plain text file en.pws. The top line must be as follows:

personal_ws-1.1 en 13

The “en” part is simply the Aspell language abbreviation for English. Please note the number at the end must indicate the number of words in your personal dictionary. Right now, I have thirteen words. They must be stacked below this line, one word per line. I put them in alphabetical order and ignore case for my own use.
Then place a copy of this file in the top Aspell folder where it’s installed. On my Win7 64-bit, that’s:

C:\Program Files (x86)\Aspell

You’ll get an argument from UAC, but it can be easily overcome if your user account as Admin rights. As you use the editor, whenever Aspell finds a word it doesn’t recognize, and you know it’s correct, simply note the word and add it to your copy of the personal user dictionary in your Documents folder. In fact, I tend to open the dictionary file in a separate tab while editing other files. Be sure to increment the count in the top line to match the number of words. You may need to run the spellcheck more than once to be sure you caught all the words. Then copy this file again, overwriting the last copy you placed in the Aspell program folder. After a while, you should find yourself doing this less and less.
Enjoy!

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

16 Responses to Notepad++ and Aspell on Win7

  1. Pingback: FOSS for Windows « Do What's Right

  2. Brad says:

    Ive also found that if you navigate to the Aspell folder, rt click the folder->properties->security and click on users and give them modify and write permissions, notepad will then edit your custom language file for you. You just have to do the back work as listed above first.

    • Ed Hurst says:

      Thanks, Brad. I seem to recall having a bit of a fight with Windows over this because I found it rather complicated and unclear. But the honest truth is I’m a Unix/Linux guy, and I really don’t like Windows. Most of my Windows articles come from brief forays onto my wife’s system. The questions come from friends; I try to solve them and write them up when I can figure it out.

  3. mike kehli says:

    You can also just take ownership for the Aspell directory. Right click on the Aspell directory. Then properties->security->advanced->ownership. Don’t forget to check the box that affects child objects and folders.

    • Ed Hurst says:

      I had considered that, but I seem to recall reading somewhere this requires care and thought, simply because changing ownerships have caused disruptions in some applications. I suppose there are scripts and such which check. Still, it’s a thought.

  4. Luiz says:

    Thanks a lot for the tip. Manual adding the words to the en.pws works like a charm.
    But I still cannot make aspell to write to this file en.pws when the button “Ignore All” is used. Aspell is installed in a c:\aspell and the path for aspell in Notepad++ is corrected to point to it. All users have Full access to this directory. Nevertheless the content of the file is not changing programmatically. But modification date of en.pws changes and reflects the last time spellchecker was used. It is weird.
    I use Win 7, Aspell-0-50-3-3, Aspell-en-0.50-2-3 and Notepad++ 5.9.6.2

  5. boardtc says:

    Great post. I got around UAC and copied en.pws to C:\Program Files (x86)\Aspell it contains:
    personal_ws-1.1 en 1
    akratic
    But when I spell check with text containing akratic it still does not recognise it…
    (Notepad 5.1, spell checker plugin 1.3.3, aspell 0.50.3)

    • Ed Hurst says:

      All I can suggest is making sure the number at the top of the file matches the number of added words. Format is critical or Aspell ignores it.

  6. I was able to get my Aspell to work on Windows 7 (Home/64bit), 8 (32bit/64bit), 8.1 (32bit/64bit) and Windows 10 (32bit/64bit).
    Here is how:
    1) Downloaded and installed Aspell Win32 (default settings):
    http://ftp.gnu.org/gnu/aspell/w32/Aspell-0-50-3-3-Setup.exe
    2) Downloaded and installed Precompiled Dictionary (e.g. English, default settings):
    http://ftp.gnu.org/gnu/aspell/w32/Aspell-en-0.50-2-3.exe
    3) INDISPENSABLE: Added Aspell directory to Windows path (e.g. C:\Program Files (x86)\Aspell\bin):
    See how to at http://www.computerhope.com/issues/ch000549.htm
    4) Confirmed your relative path for spell checker is:
    ..\Aspell\bin
    5) Clicked on Spell Check button and it worked.
    Hope that helps!

  7. Martin Green says:

    The problem with Aspell on Windows 7, 8.x, and 10 is that even if the user has full rights to the C:\Program Files (x86)\Aspell directory, Windows UAC won’t let an application write to that directory unless the application is run as Administrator, so you either need to always run NotePad++ as Administrator, or move the en.pws and en.prepl files somewhere that UAC doesn’t block. Although running NotePad++ as Administrator is a quick-and-dirty workaround, it makes it impossible to right-click on a file and open with NotePad++ since that way you can’t tell Windows to run it as Administrator.
    The better solution is to move en.pws and en.prepl outside the C:\Program Files (86) tree. The problem with this is that Aspell expects to find these files in the installation directory and can’t be configured to look elsewhere. While this would seem to stop this solution in its tracks, there is an easy fix that works perfectly. Basically you need to move those two files somewhere else on your C: drive that isn’t blocked by UAC (here we’ll use %appdata% or %programdata%) and then create matching hard links in C:\Program Files (x86)\Aspell so that Aspell thinks they are still in their original location.
    First, open a CMD window as Administrator, CD to the Aspell program directory, and create an Aspell directory somewhere that is writable ON THE C: DRIVE. (hard links only work with real locations on the same drive)
    cd C:\Program Files (x86)\Aspell
    md %appdata%\Aspell
    …or…
    md %programdata%\Aspell
    …next move the two files to the new directory…
    move en.pws,en.prepl %appdata%\Aspell\
    …or…
    move en.pws,en.prepl %programdata%\Aspell\
    …now create hard links to replace the files we just moved
    mklink /h en.pws %appdata%\Aspell\en.pws
    mklink /h en.prepl %appdata%\Aspell\en.prepl
    …or…
    mklink /h en.pws %programdata%\Aspell\en.pws
    mklink /h en.prepl %programdata%\Aspell\en.prepl
    …and now you can close the CMD window.
    Now when NotePad++ tells Aspell to update the personal dictionary, Aspell will think it is writing the files in its own directory, but actually the updates are going to the link targets, which are not protected by UAC. No more error messages when you try to update your personal dictionary.

    • Ed Hurst says:

      Thank you, Martin Green. I suppose Notepad++ still cripples on Win7 the DSpellCheck that works so much better? Would it amuse you if I said Notepad++ works a lot better under Linux with WINE?

  8. Martin Green says:

    Hey Ed, I don’t know what happens on Win7, or what you mean by “cripples”. I just started using DSpellCheck this week i lieu of Aspell, and I converted the last Win7 PC in my house to Win8.1 a month ago. I’m guessing WINE doesn’t have UAC, so I’m not surprised that some apps run smoother there than on Windows itself. That is not Windows fault, Microsoft provides several places that applications can store their configuration and working data seamlessly, but applications like Aspell which were ported from other platforms don’t play by the rules of no writing to “C:\”, “C:\Program Files”, or “C:\Program Files (x86)”. Although it’s annoying when tools like Aspell won’t run properly without workarounds, it actually means that Windows is doing it’s security job.
    Cheers.

    • Ed Hurst says:

      Quite recently, the Notepad++ developers had trouble getting DSpellCheck to work on Win7, and there were some complaints on Win8. They began installing with DSpellCheck disabled for a few releases. Maybe they fixed that issue, but I can’t check as I don’t run Win7 any more. As I recall, Aspell was modified enough to work on XP, but was never brought forward into the UAC era starting with Vista. Porting between Winworld and Unixland has gotten pretty dicey these days.

      • Martin Green says:

        Well, I only started using DSpellCheck this past week so I can’t really comment on how well it is working on Win8.1. If I run into any problems I will leave a comment here. In the meantime my method lets Aspell work with NotePad++ again.

Comments are closed.