How to Spell Check a Word Document with AutoHotkey

Word := ComObjActive("Word.Application") ; Connects to the open Word application
Doc := Word.ActiveDocument ; The open Word document

result := "Spelled incorrectly."

startLocation := Doc.Content.Start
endLocation := Doc.Content.End
spellCheck := Doc.Application.CheckSpelling( Doc.Range(startLocation, endLocation).Text )

if (spellCheck != 0) {
    result := "Spelled correctly."
}

MsgBox % result ; Display a message of the result