Is there a way to add all the .NET object names to my dictionary in MS-Word? I use them a lot when writing daily progress notes or documentation and it would be nice if auto-correct didn't chide me every time, but actually helped me identify the correct word I am looking for. I know how to add a single word manually, but that is not an option. Is there a quick/built-in way to add all these names, or do I need to edit a file programatically?
Asked
Active
Viewed 144 times
1
-
How are you manually doing this? – Austin T French Aug 16 '13 at 13:15
-
@AthomSfere - there's a couple of ways to "manually" add a single word such as typing it and right-click>add to dictionary or [this answer](http://superuser.com/a/58973/52574) – Joel B Aug 16 '13 at 13:17
-
@JoelB: Rather than right-clicking them individually it is easier to press F7 to show the spelling dialog and then for each one click Add to Dictionary (Alt + A). – James P Aug 16 '13 at 13:41
-
There are thousands of classes in the base system assemblies (system, mscorlib) but if you take into account other assemblies like system.web you get a huge number. Also don't forget that many method names will also cause the spell checker to complain. That is why I think it is easier to add the names manually using the method above. – James P Aug 16 '13 at 14:02
-
Another option: If you use a specific style(s) in your documents for .NET code you can disable spelling checking for it. (Google disable spell checking for code in Microsoft Word). – Brian Aug 18 '13 at 05:23
1 Answers
1
This should work from PowerShell:
$net4 = gci "C:\Windows\Microsoft.NET\Framework\v4.0.30319" | Where-Object {$_.Extension -eq ".dll"}
$net4 | ForEach-Object {
$_.name | Out-File "C:\Users\YourUser\AppData\Roaming\Microsoft\UProof\CUSTOM.DIC" -Append
}
You could either have it loop through all frameworks to be safe, or do it once for each .NET directory.
Also, if you want the filename without the extension (.dll) use $_.Basename
Update: Ran the script and it did work for me. I added the libraries this way, mscorlib for example.
I am also able to get methods:
$net4 = gci "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\" -Recurse -Force | Where-Object {$_.Extension -eq ".dll"}
$Methods
$net4 | ForEach-Object {
$Methods += $_ | Get-Member -Force -View All | Select -ExpandProperty Name
}
$Methods | Out-File "C:\Users\UserName\AppData\Roaming\Microsoft\UProof\CUSTOM.DIC" -Append
And it gets me (among lots, lots more):
OpenWrite
Refresh
Replace
SetAccessControl
set_Attributes
set_CreationTime
set_CreationTimeUtc
set_IsReadOnly
set_LastAccessTime
set_LastAccessTimeUtc
set_LastWriteTime
set_LastWriteTimeUtc
ToString
PSChildName
PSDrive
PSIsContainer
PSParentPath
PSPath
PSProvider
Attributes
Now the problem is there are many duplicates, but from here it should be simpler.
You could also use the C:\Windows\Microsoft.NET\Framework directories instead of the GAC if you wish.
Austin T French
- 10,505
- 27
- 42
-
This is close. This, at best, only adds the DLL name which is not the object name. Objects are contained within the DLL and I'm looking for those names (things like `ISerializeable` or `DivideByZeroException`) to be added to my dictionary. – Joel B Aug 16 '13 at 13:50
-
Ah, that crossed my mind later. I will have to think about if I can expand with that in mind. – Austin T French Aug 16 '13 at 14:08
-
I asked here because I was hoping a PowerShell script could do it, but I think this is going to be a .NET only game using `Reflection`. – Joel B Aug 16 '13 at 14:11
-
1PowerShell can use reflection... And that's precisely what I am looking for. – Austin T French Aug 16 '13 at 15:04