Thursday, August 29, 2002

Spell Check for Web Forms

This is a bookmarklet. Can be used to check a multiline text field before pressing "submit". Could prevent some embarrassing usergroup postings. Works with IE. I found this gem while meandering Blogarithms.

I got this from the 9/3/02 issue of PC Magazine. (Can't find it on line.) Here's some JavaScript that works with IE:

oShell=new ActiveXObject ("WScript.Shell");
oShell.SendKeys ("^c"); //copy
oWord = new ActiveXObject ("Word.Application");
oWord.Visible = true;
oWord.Documents.Add();
oWord.Selection.Paste();
oWord.ActiveDocument.CheckSpelling();
oWord.Selection.WholeStory();
oWord.Selection.Copy();
oWord.ActiveDocument.Close(0);
oWord.Quit();
var nRet = oShell.Popup ("Apply changes?\nClick OK to replace all selected text.", 0, "Spell Check Complete", 33);
if (nRet==1) {oShell.SendKeys ("^v");}

Paste the above into a file such as spellcheck.js. Drag the icon for this file to IE's "Links" toolbar and rename the link. Select text in any browser text box and click on the button. It launches Word, runs the spell checker, and replaces the text. Not ideal, but better than nothing.

[Noise]

2:43:03 AM  comment [] | Categories: 80-20 Web Development|