ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Autoreplace in clipboard

<< < (5/5)

WhiteLion:
Spell check & correct contents of Windows clipboard.

You need to have Word 97 or higher installed. To use copy text to clipboard & click on the script. After corrections are complete you can paste the corrected text back to the original or another document.

Copy the following script below and paste it to a new blank .txt file then rename it to Spellcheck.vbs




--- ---WScript.Echo(SpellCheck())

Function SpellCheck()
  'compatibility check
  On Error Resume Next
  Set oWord = CreateObject("Word.Application")
  If Err Then
    SpellCheck = "Your system does not support Spell Check." & vbcrlf & _
                 vbcrlf & "You must have Microsoft Word 97 or higher " & _
                 "installed to enable this feature."
    Exit Function
  End If
  On Error GoTo 0
  With oWord
    .Visible = false
    Set spellDoc = .Documents.Add
    'trap errors for empty or invalid clipboard contents
    On Error Resume Next
    .Selection.Paste
    If Err Then
      spellDoc.Close
      .Quit
      SpellCheck = "Unable to spell check current clipboard contents." & _
                   vbcrlf & vbcrlf & "Highlight text selection to spell " & _
                   "check, use Ctrl + C" & vbcrlf & "to copy it to " & _
                   "clipboard, then click the Spell Check button."
      Exit Function
    End If
    On Error GoTo 0
    strIn = spellDoc.Content.Text
    spellDoc.CheckSpelling()
'   spellDoc.CheckGrammar()
    strOut = spellDoc.Content.Text
    If strIn = strOut Then
      results = "No spelling corrections made."
    Else
      results = "Spelling corrections copied to clipboard."
    End If
    .Selection.WholeStory
    .Selection.Copy
    spellDoc.Close False
    .Quit True
  End With
  SpellCheck = results
End Function

Navigation

[0] Message Index

[*] Previous page

Go to full version