Register forum user name Search FAQ

SpellCheck

Script function

world.SpellCheck

Read about scripting

Type

Method

Summary

Spell checks an arbitrary string of text

Prototype

VARIANT SpellCheck(BSTR Text);

View list of data type meanings

Description

This function lets you call the MUSHclient spell-checker from a script on any arbitrary text string.

Note that if the spell-check engine has not been initialised (eg. the DLL is not present, or the spell check dictionary is not there), it returns the Empty variant (or nil in Lua).

You supply a string of text to be checked.

If there are no spelling errors, the number zero is returned.

If there are spelling errors, a variant array of all of the misspelt words is returned. You can then iterate through that array to display the misspelt words.

If your spell checker has been configured to detect duplicates (eg. "a bird in the the hand") then they will be returned as duplicated words in the list (eg. "the the"). You could detect that by looking for a space in the returned word.

The spell checking is done with the currently-configured spell-check options (eg. whether words in capitals are checked, whether duplicates are checked).

There is no GUI interface (that is, no "correct this word") dialog box will appear.


Available in MUSHclient version 3.54 onwards.



VBscript example

result = SpellCheck _
  ("Twas brillig, and the slithy toves Did gyre and gimble in the the wabe")

Note vartype (result) ' array of variants will be 8204

if vartype (result) = (vbArray + vbVariant) then
  For Each w In result
      world.note w
    Next
elseif IsEmpty (result) then
  Note "Spell check not available"
else
  Note "No spelling errors"
end if


Lua example

result = SpellCheck (
  "Twas brillig, and the slithy toves Did gyre and gimble in the the wabe")

print (type (result))

if result == nil then
  Note "Spell check not available"
elseif result == 0 then
  Note "No spelling errors"
else
 for _, v in pairs (result) do print (v) end
end


Return value

If the spell checker is not available an Empty variant (or nil in Lua).

If there were no spelling errors, a numeric result of zero.

If there were spelling errors, a variant array consisting of each misspelt word. If the same word was misspelt twice, it is only returned once. The array of misspelt words is in alphabetic order.


See Also ...

Topic

Spell checker

Functions

(AddSpellCheckWord) Adds a word to the user spell check dictionary
(SpellCheckCommand) Spell checks the text in the command window
(SpellCheckDlg) Spell checks an arbitrary string of text, invloking the spell-checker dialog

(Help topic: function=SpellCheck)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.