Skip to content

Instantly share code, notes, and snippets.

@jerone
Created February 6, 2018 13:53
Show Gist options
  • Save jerone/a8d20396390897e9c99a9d1785e8ee68 to your computer and use it in GitHub Desktop.
Save jerone/a8d20396390897e9c99a9d1785e8ee68 to your computer and use it in GitHub Desktop.
Add word to Word dictionary with Powershell
$dicFile = (Get-Content Env:AppData) + "\Microsoft\UProof\CUSTOM.DIC"
Add-Content $dicFile "`r`nJERONE" -NoNewLine
@jerone
Copy link
Author

jerone commented Feb 6, 2018

image

Testing...

#$dic = New-Object -COM Scripting.Dictionary #credits to MickyB
#$w = New-Object -COM Word.Application
#$w.Languages | % {if($_.Name -eq "English (US)"){$dic=$_.ActiveSpellingDictionary}}
##$w.checkSpelling("Time", [ref]$null, [ref]$null, [ref]$dic)
#$w.CustomDictionaries

$word = New-Object -ComObject word.application

$dicFile = (Get-Content Env:AppData) + "\Microsoft\UProof\CUSTOM.DIC"
Write-Host $dicFile

#(Get-Content $dicFile | Out-String) -replace "`n", "`r`n" | Out-File $dicFile
Add-Content $dicFile "`r`nmillennials" -NoNewLine

#$net4 | ForEach-Object {
#$_.name | Out-File "C:\Users\YourUser\AppData\Roaming\Microsoft\UProof\CUSTOM.DIC" -Append
#}


#$objFSO = New-Object -COM Scripting.FileSystemObject
##$objFile = $objFSO.OpenTextFile("$($w.CustomDictionaries.ActiveCustomDictionary.Path)/$($w.CustomDictionaries.ActiveCustomDictionary.Name)", 2)
#$objFile = $objFSO.OpenTextFile("C:\Users\YourUser\AppData\Roaming\Microsoft\UProof\CUSTOM.DIC", 2)
#
##strComputer = "."
#
##Set objWMIService=GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
# 
##For Each objClass in objWMIService.SubclassesOf()
#$objFile.WriteLine("jerone")
##Next
#
#$objFile.Close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment