Strange request, but bear with me...
We need to do some spell checking on an internal ExtJS application.
The key there is "internal" which means we have a known platform of Internet Explorer with Microsoft Word installed, and one of the "nice to haves" is to use the user's own dictionary in Word.
I have a nice little piece of code which I've used a lot previously to do exactly this... but my problem is that it's in VBScript so I will need to either inject this script into my page at some point, or a reference to an include, and then call that function, all in my ExtJS 4.1.3 MVC app.
What is the best/recommended way of doing this?
The VBScript function is very simple, and is currently in an include file, and consists of the following code. Remember that this needs to stay as VBScript to interact with the Windows environment and launch Word.
Code:
function Spelling_Grammar(TextValue)
Dim objWord, objDocument, strReturnValue
Set objWord = CreateObject("word.Application")
if objWord IS NOTHING then
MsgBox "Microsoft Word is not installed!" & vbCr & "This is required to check spelling.", vbCritical, "Error"
else
objWord.WindowState = 2
objWord.Visible = False
'Create a new instance of Document
Set objDocument = objWord.Documents.Add
objDocument.Content=TextValue
objDocument.CheckSpelling
'Return checked text and quit Word
strReturnValue = objDocument.Content
objDocument.Close False
objWord.Application.Quit True
MsgBox "Spelling Check Complete!", vbInformation, "Spelling"
end if
Spelling_Grammar=strReturnValue
End function
You can call the function very simply from a button or image using the following:
Code:
onClick="document.all.boxId.value = Spelling_Grammar(document.all.boxId.getText())">
So ideally I would like to include a reference to my SpellCheck.vbs file (somewhere) in my ExtJS code, and then call the function as above.
Any thoughts appreciated!